Re: More Wishlist Things

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

On Monday 25 June 2001 00:50, Tony Bucholtz wrote:

> G'day all
>
> While we're talking about wishlist items, I'd like to see some
> support for a shorthand notation in Euphoria,....

> <shorthand>
> for i = 1 to length(mainseq)
>    with mainseq[i]
>       [21] = [5] + [15]
>       [22] = [8] - [9]
>       [23] = ([12] / [13]) + [5]
>       < lots more of the same>
>
> I know this could be done with a preprocessor, and I also know
> that the "with..end with" syntax has been linked with namespaces,
> but it still would be a nice thing to have, whatever the syntax.
>
> Regards
> Tony

Actually, there's no reason I can see that the same syntax couldn't 
be used for both. (namespacing and 'structures').

While your shorthand above would be a big improvement, I would really 
like to see it implemented fully: e.g:

    with customer [ i ] do
          NAME = "Joe Blow"  -- not [NAME], just NAME
          ADDR = "1234 Fifth St."
          with TXN [ 4 ] do
                 ITEM = "Dog food"
                 AMT = 2.99
          end with 
     end with

Which would be a welcome relief  from the abominable:

customer[i][NAME] = "Joe Blow"
customer[i][ADDR] = "1234 Fifth St."
customer[i][TXN][4][ITEM] = "Dog food"
customer[i][TXN][4][AMT] = 2.99

When you have a bunch of nested fields, this kind of thing gets 
error prone,  and not only your code, but Euphoria as well, looks bad.

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu