Re: From a newbie
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Sep 20, 1998
- 627 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