Re: Re[2]: Multitask Feedback

new topic     » goto parent     » topic index » view thread      » older message » newer message

D. Newhall wrote:
> 
> akusaya wrote:
> > 
> (snip)
> > 
> > Again, and again, how about a feature to ignore return values after
> > calling a function? It's really annoying, almost every time I make a
> > little Eu program I need to do something like
> > 
> > PP = seek(fn, 100)
> > 
> > where PP is a global variable I defined in aku.e which is an include
> > file I always include when starting to write a new Eu program. (almost
> > never write a Eu program without an "include"!)
> > 
> > All languages I know allow ignoring function return values. Why not
> > Eu?
> > 
> > (BTW, I tried making a website with PHP, unexpectedly it's not a lot
> > harder than using Eu, but much easier since it has rich functions and
> > database access functions)
> > 
> 
> Well, functions return values for a reason and it's not that hard to ignore a
> return
> value. Is it annoying? At times, yes. Worth adding some language construct to
> the langauge
> to remedy it? Definitely not.
> 
> Here, this is what I use:
> 
> }}}
<eucode>
> procedure ignore(object x)
>     -- Do nothing, just ignore the object passed
> end procedure  -- ignore
> 
> ignore( seek(fn, 100) )
> </eucode>
{{{

> 
> It's not that hard to implement and use, looks neat and clear, and most
> importantly
> doesn't change Euphoria in any way.
> 
> 
> The Euphoria Standard Library project :
>     <a href="http://esl.sourceforge.net/">http://esl.sourceforge.net/</a>
> The Euphoria Standard Library mailing list :
>     <a
>     href="https://lists.sourceforge.net/lists/listinfo/esl-discussion">https://lists.sourceforge.net/lists/listinfo/esl-discussion</a>
> 

Hi there,

That's a good idea.  I can go either way with this though.  After all,
it doesnt take too much to ignore a return value, yet it wouldnt take
any new keyword to modify the language either.

  i=seek(fn,a) --i need the return value
  seek(fn,a)   --i dont need the return value

It's also hard to believe this would cause many problems, because
im wondering who could make an error like these:

  seek(fn,a)  --whoops!  I really needed the return value here! :)

  i=seek(fn,a) --Oh geeze!  I didnt really need the return value here! :)

Would anyone make this kind of error if it worked both ways?

With my C compiler (not sure if this is typical for compilers) it
allows you to call Win API functions as either a function when you need
the return value:
  c=SetColor(new)
or as a procedure when you dont:
  SetColor(new)
  

I think most people do something like this in Euphoria...

  object void --local or global
  void=seek(fn,a)
  void=SomethingElse()
  etc.

although Rob seems to prefer:

  if seek(fn,a) then end if


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu