Re: mainly syntax
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Feb 18, 1998
- 765 views
>Cameron Kaiser wrote: > >>I tried Python, but I'm not a fan of object oriented languages and at least >>Perl lets you not be OOP if you want to. (Although to my displeasure it's >>leaning OOP heavily these days. Gimme Perl 4 back!) But I did like the >>syntax; very lucid > >Cameron also mentioned syntax. I think it is quite important, because >computer languages are a bit like religions, and syntax matters a lot >especially in the early stages of conversion. I like Euphoria's >syntax, but I must admit I am getting tired of some aspects of it, >e.g. endlessly typing 'end procedure', 'end if', 'end while', etc. It >is just as useful as 'begin... end' brackets, or the semicolon in >pascal... I am not advocating Python's use of indentation, it is too >controversial, but what about replacing the whole lot of these >crutches with a simple "." (dot). So instead of, say, A dot more or less looks ok, but easily creates an error, there is btw no endless typing with the syntax completition, as the standard editor does. >And while I am raving about syntax, I cannot understand this >completely artificial distinction between procedures and functions. >After all, functions are merely routines that return a value while >procedures do not. So why a different mechanism? The so called >'safety' argument is even weaker here than for the crutches above. What do you mean by this ? That statements, like in C, should return a value also. That would be more efficient and in some cases more clear, however is most cases it makes the code less readable and the efficiency could also be made up by a smart optimizer. >Perhaps one more syntactic niggle: I seem to be writing about thousand >times a day something like x = s[length(s)], or s1 = s2[m..length(s2)] >This could easily be replaced by, say, x = s[-1], or s1 = s2[m..-1], >which is more elegant and saves the function call overhead as well. -1 is more elegant ? 'end' might be more elegant, but a number as -1 isn't The overhead btw, is almost zero, it's a built-in function.. and it has to lookup the length anyway, because the length may vary during run-time. >I better stop here, otherwise Ralf will justly start complaining about >the amount of space I usurp on this server. Jiri Why ? Not again! Do you have some kind of problem with me ? If so, talk to me, or get professional help, instead of trying to insult me to the rest of the group. Grow up! Ralf