Re: Returning multiple elements

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

Gabriel Boehme wrote:

> So, with this thought in mind, why don't we create a
> new method for returning/receiving multiple values from
> a function -- putting them between parentheses.

This suggestion has come up in the past (even from me), and didn't seem to
go over well with Robert. Something about violating clean coding rules or
somesuch.

Since I'm on my soapbox again, I'll mention again my 'dot' notation
pre-processor, which can be found on the Euphoria website. Using it, the
expression:

   foo.bar( 1, 2, 3 )

is expanded into:

   bar( foo, 1, 2, 3 )


For example:

   b = a.plus(12)
   count = s.length()

would become:

   b = plus( a, 12 )
   count = length( s )

If a function's value isn't assigned, it is assigned to itself. For example:

   s.append( "123" )

would become:

   s = append( s, "123" )

I found this to be a very readable and logical notation, and used it for a
while. I finally discarded it when I decided it was pretty pointless to
fight the tide of 'pure' Euphoria. But the pre-processor shows that it's
entirely feasible, and cheap to implement.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu