procedures and functions (Re: mainly syntax)
- Posted by Jacques Guy <j.guy at TRL.TELSTRA.COM.AU> Feb 18, 1998
- 666 views
BABOR, JIRI wrote: > >However, I remembered an article from way back in > >which some big shot in computer science was arguing that a procedure > >should be allowed only two parameters: input, passed by value (i.e. > >read-only) and output. Euphoria implements it partly in its own way, > >and I have no bones about it. > Enlighten us! Did she/he have a valid argument or was it just the big > shot's name that impressed you so much? No, I am not one to believe big shots who have nothing more than their names. It was a valid argument, even though I remember thinking to myself "he is stretching it a bit". But, as I said, Euphoria goes a long way towards implementing easily, because it has sequences, so, instead of passing several parameters, you pass one: a sequence. Just like in the Euphoria procedure printf(). I do not remember the argument, only that it had to do squashing the bugs in the egg before they hatch (he didn't call it that, of course). > >That is strange, not syntax, but semantics. This use of -1 is an > >exception > >worthy of C's "->" which really stands for "*.", is not easier to type, > >and adds one more thing to remember which could be dispensed with very > >nicely. <snip> (Alors, la, il est pas content:) > Ok, if speed does not matter to you, or if you have a memory problem, > go on, use length(); -1 value would wake *me* up! Jiri Speed matters to me, and a great deal. That is why I'd rather spend half a second more typing, rather have to scratch my head for a minute wondering what the bloody hell that -1 means. That -1, once implemented, is the a door open to all sorts of programmer-hostile syntax and semantics. Not to speak of a growingly nightmarish parser for who writes the compiler. What made Turbo Pascal the first lightning-fast compiler is the syntax of the language, what allows Oberon even faster compilers is again its syntax, which is a subset of Object-Oriented Pascal. Those things also considerably reduce the chance of bugs in the parser, and, of course, make it vastly easier to write. I'll gladly spend a bit more time typing for that. Especially since Euphoria saves me all those BEGINs, those VARs, and that swarm of semicolons. On the other hand, there are extensions to the syntax which I wouldn't mind, to spare me some typing. For instance: myLongString = append(myLongString, " more stuff yet") Well, I wouldn't mind this alternative notation: myLongString.append(" more stuff yet") But I wouldn't like to have to write the parser for that, so, I'd be quite happy with something like: myLongString=append(self," more stuff yet") or something like that, which would be easier to implement. (And I can remember what "self" means without too much trouble) Two other things that would be nice (I filched the idea from Oberon): include myRoutines.e as x whatever = x.thisFunction(whateverElse) In that way I wouldn't have to worry about identical global identifiers in different include files doing different things. But I am not *asking* for any of those things. So far, I seem to make do with Euphoria as it stands. And, for the price I paid... Turbo Pascal was $49.95 when it came out (its granddad, Compas Pascal was $200). Those were the days when Mad Magazine cost 45c or so. So, at forty bucks, Euphoria is only a fiver of back then.