Programming Languages: Pining for BASIC? : comments.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1
|
2
|
3
|
||||
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13 |
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
Re: universally available
Its major annoyance, however, is that its OO is incomplete. Constants don't seem to be objects. Various operations work in a functional way rather than an OO way, while other operations are OO. Therefore it can be difficult to intuitively figure out whether to do x.foo or foo(x) or ClassName.foo(x).
I was quite happy when I discovered that Ruby fixes all these problems, plus includes many of the conveniences of Perl.
Someday I might mess with Erlang or Haskell. The only functional languages I've done anything with are Lisp and Scheme, and I haven't done much with them.
Re: universally available
"in the face of ambiguity refuse the temptation to guess". Whether or not you prefer one probably depends on your personality. Since they are both very capable.
I think they are close enough the 2nd order effects become important in choosing (do you need a web framework=ruby, do you need heavy number crunching == python)
With regards to indendation, in most common programming languages you indent anyways. Effectively, it is as if you have the same code with the parens (or whatever) erased. In other words, the parens are superfluous line noise. I've programmed in other languages for years, and I have never found myself limited by python's indentation. Perhaps in theory there could be a problem just like in theory static compile time typing may give you more reliable code. However, in practice that does not seem to be the case. It is probably something you have to try to know.
Ruby has an ambiguity, though I could be wrong. In Python you have to have () if you want to do any type of call: foo() object.foo(),etc.
In Ruby, object.foo -- is it a method call or an attribute? You cannot tell w/out more context which means you have to look at more code.
Erland, btw, looks really cool. Just like bytecode from back in the 80's pascal days is finally coming into fruition, I see erlang's ideas about threading (I think they got like 20 million threads running on a typical sun box!) to be something other languages will look at.
I'm tired, I hope most of this is coherent . . . .
Ruby, Python, etc.
I disagree that block markers are superfluous. It's useful to see exactly where a structure ends, and it also helps some editors with their features. Also, doesn't Python treat a tab as a single indent rather than 8?
But anyway, I don't see the indentation thing as a big deal, just a quirk. The inconsistent OO is more bothersome to me.
As for the object.foo thing... it could be argued that it's a feature not a bug, as in "you shouldn't really need to know whether it's a method or an attribute."
I don't really know anything about Erlang....
Re: Ruby, Python, etc.
With regards to "you shouldn't really need to know whether it's a method or an attribute."
I think you do need to know. In ruby the mention of an object either means a reference or a call to the object. If you don't pay attention, you may accidentally call something when you didn't intend to. So, it is necessary to know.
Btw, I am not saying python is better than ruby. Python does have warts like with default arguments being bound only when the function is created and such. In practice, I just never found the things you mentioned to be warts.