1. From a newbie
- Posted by =?ISO-8859-2?Q?Tom_=A9upka?= <TomSupka at BIGFOOT.COM> Sep 20, 1998
- 453 views
Hi, I am a very newbie to Euphoria - I tried it since I need free data = structure in my project. Euphoria succeeded! I've written working Code = Generator Genarator within a day. My questions: 1. Conditional expressions are fully evaluated. Is it an Euphoria bug?=20 I never use this language "feature". I know that it is optional in = Borland Pascal/Delphi and in Java but I prefer (and don't know anybody = who don't) shortcut evaluation. It's faster and more usable. For example = if you run this in Euphoria: if integer(x) and x<0 then -- ... end if where x can be of any type (object), you probably end with RTE. Shortcut = evaluation can be substituted, in Euphoria, only with nested if - it's = inefficient and annoying. 2. Is there any possibility to change value of non-global variable (e.g. = an argument) inside function/procedure? Euphoria language extension suggestions: 1. If answer for Q2 is "No" make it possible - in/out arguments. in - argument is an input (default) out - argument is an output in out - both as input and output 2. Structured gotos (as in Java) and exceptions implementation. 3. "dot" operator. For example: const fX =3D 1, fY =3D 2 sequence p p.fX =3D 0 -- means p[fX] =3D 0 p.fY =3D 0 -- means p[fY] =3D 0 -- It makes code more readable. 4. All preprocessor's (pp) extensions. Tom
2. Re: From a newbie
- Posted by David Cuny <dcuny at LANSET.COM> Sep 19, 1998
- 447 views
Tom wrote: > 1. Conditional expressions are fully evaluated. Is it an Euphoria bug? Short-circuiting is promised Real Soon Now. > Is there any possibility to change value of non-global variable > (e.g. an argument) inside function/procedure? No. I won't address your requested features, since that's Robert's job. -- David Cuny
3. Re: From a newbie
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Sep 20, 1998
- 470 views
>Hi, >I am a very newbie to Euphoria - I tried it since I need free data structure in my project. Euphoria succeeded! I've written working Code Generator Genarator within a day. Welcome, >1. Conditional expressions are fully evaluated. Is it an Euphoria bug? >I never use this language "feature". I know that it is optional in Borland Pascal/Delphi and in Java but I prefer (and don't know anybody who don't) shortcut evaluation. It's faster and more usable. For example if you run this in Euphoria: Euphoria 2 will short-circuit, and give a warning message with those programs where it could led to a problem, when the programmer is not consider the short-circuiting.. >2. Is there any possibility to change value of non-global variable (e.g. an argument) inside function/procedure? Thankfully not at all, its much cleaner this way. The only way to do this is to use the return value, thankfully you can just make a sequence out of it: function myfunc (sequence s, integer x) s = s + x x = x * 2 return {s, x} end function Its the only way, however, if you use David Cuny's new preproccesor you can use dots for this use: So you could make a function call like this one: function myfunc (sequence s, integer x) .. bla bla bla.. return s end function my_seq = myfunc (my_seq, 45) Look like this: my seq.myfunc (45) >Euphoria language extension suggestions: > >1. If answer for Q2 is "No" make it possible - in/out arguments. >in - argument is an input (default) >out - argument is an output >in out - both as input and output I disagree, the programmer using the function wouldnt preciously know which variables could or could not have been altered. However, a very nice replacement trick for this is: (something I would like to see added) { name, addres, phone } = lookup_db (name) See ? Here the programmer does see what is altered, yet he doesnt have to split the sequence himself like: temp = lookup_db (name) name = temp[1] addres = temp[2] phone = temp[3] Which I agree is a bit ugly.. >2. Structured gotos (as in Java) and exceptions implementation. I find them a bit scary.. but there are cases they are handy.. What about this one, Robert ? exit (3) -- jump out three levels Too often, do I need to use a flag variable to mark that Im jumping out of more than one loop. >3. "dot" operator. For example: >const > fX = 1, > fY = 2 >sequence p >p.fX = 0 -- means p[fX] = 0 >p.fY = 0 -- means p[fY] = 0 >-- It makes code more readable. Structures are under consideration, I suspect. many people want this, and no one is against them. >4. All preprocessor's (pp) extensions. Agree with you on that. However, the two dot-notations would make a bit of confusement. Actually, the dot preproccesor is not clean enough for euphoria I think. But the for each in.. is brilliant..and allows great clean optimizing.. So, Robert, had a nice vacation ? A serieus suggestion list here, any one any implentation suggestions ? Ralf Nieuwenhuijsen nieuwen at xs4all.nl
4. Re: From a newbie
- Posted by =?ISO-8859-2?Q?Tom_=A9upka?= <TomSupka at BIGFOOT.COM> Sep 20, 1998
- 468 views
>Euphoria 2 will short-circuit, and give a warning message with those >programs where it could led to a problem, when the programmer is not >consider the short-circuiting.. Will do or does? >>Euphoria language extension suggestions: >> >>1. If answer for Q2 is "No" make it possible - in/out arguments. >>in - argument is an input (default) >>out - argument is an output >>in out - both as input and output >I disagree, the programmer using the function wouldnt preciously know = which >variables could or could not have been altered. Yes, the programmer knows it - right from the function interface he/she = declares (using in/out). >However, a very nice replacement trick for this is: (something I would = like >to see added) >{ name, addres, phone } =3D lookup_db (name) Oh, great! It looks like unification (what about anonymous variables?). >>2. Structured gotos (as in Java) and exceptions implementation. >I find them a bit scary.. but there are cases they are handy.. >What about this one, Robert ? >exit (3) -- jump out three levels Now, I disagree. It's only partial solution - I don't know in advance if = I put the code with exit(3) inside/outside another block (so the level I = want to jump out could be changing). The labeled (i.e. named) statement, = which is to be jumped out to, is much more robust and clear. Tom
5. Re: From a newbie
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Sep 20, 1998
- 463 views
>>Euphoria 2 will short-circuit, and give a warning message with those >>programs where it could led to a problem, when the programmer is not >>consider the short-circuiting.. >Will do or does? The next release, not yet available to public *does* short-circuiting.. its already put in the ex.exe It only works in if's, not in normal expressions though. (I think, some one correct me when Im wrong) >>>Euphoria language extension suggestions: >>> >>>1. If answer for Q2 is "No" make it possible - in/out arguments. >>>in - argument is an input (default) >>>out - argument is an output >>>in out - both as input and output >>I disagree, the programmer using the function wouldnt preciously know which >>variables could or could not have been altered. >Yes, the programmer knows it - right from the function interface he/she declares (using in/out). Actually it is quite an interesting approuch, no return value, but just using the argument list, for communication both ways. I must admit its interesting, but Robert will never ever add this. It will break all original code anyways. And it doest exactly fit in Euphoria's priorities. Its completely based on the ideology of readability, safety and speed. >>However, a very nice replacement trick for this is: (something I would like >>to see added) >>{ name, addres, phone } = lookup_db (name) >Oh, great! It looks like unification (what about anonymous variables?). Robert, I must agree function calls shouldnt be sliced, but this way, no value gets discarded. Why not add the { .. } assignment ?? Many are in favor of this... >>>2. Structured gotos (as in Java) and exceptions implementation. >>I find them a bit scary.. but there are cases they are handy.. >>What about this one, Robert ? >>exit (3) -- jump out three levels >Now, I disagree. It's only partial solution - I don't know in advance if I put the code with exit(3) inside/outside >another block (so the level I want to jump out could be changing). The labeled (i.e. named) statement, which is >to be jumped out to, is much more robust and clear. True, yet, up until now, we dont have labels yet, it will take a lot of consideration before labels are added. On the other hand, I must admit, its very helpfull, and actually eliminates some of comments, you would add anyway, to describe the crucial loop, so it does add for more readability, and it makes an algorithm look so much more simple and natural. Robert ? I know you are almost burried in suggestions, but I think its time another priority is added to Euphoria. These already exist: -readability (it has to look easy and simple) -safety -speed Why not seriously consider upgrading the power of expression. All this suggestions (in this mail at least) if were used, make a program look *so* much more natural, the way we were thinking of the algorithm. We dont think in flags, to get out of multiple layers of a loop-construct. We dont think in assigments of every element from a return value. Also, while we're at suggestions any ways. Lets make a list, people: - structures (no dicussion needed anymore, is there ?) - { .. } assignment (any one disagrees ?) - labeled goto's (it wont happen, I think, but I totally agree with Tom) And, these non-discussed suggestions: a global variable called discard. Its ok, to *not* use a return value, as long as you can easily see, you are doing that. discard = myfucn () I mean, every one can see the return value will not be used. Why not add this global variable, which use of it in an expression would only be allowed when the expression itself is stored in discard again. For example: puts (1, discard) *crash* discard can only be assigned values) discard = { x, y, discard } *legal* Any pros, cons ? Ralf
6. Re: From a newbie
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Sep 21, 1998
- 505 views
Ralf just wrote: >discard = { x, y, discard } > >*legal* > >Any pros, cons ? > >Ralf > I need some guidance: is this a joke? jiri
7. Re: From a newbie
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Sep 20, 1998
- 461 views
- Last edited Sep 21, 1998
>Ralf just wrote: > >>discard = { x, y, discard } >> >>*legal* >> >>Any pros, cons ? >> >>Ralf >> >I need some guidance: is this a joke? jiri Where did I hear that question again and how exactly did you respond when the question was directed at you, Jiri ? Hmm, a bit hypocryt, dont you think ? Ralf