Re: Discussion concerning [POLL] Sequences of types

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

Juergen Luethje wrote:
> Say we have something like
>    names = {"Tom", "Mary", "Bob"}
> 
> If the new syntax is not restricted, then at least each of the following
> would be syntactically correct:
>    object names
>    sequence names
>    sequence of sequence names
>    sequence of sequence of object names
>    sequence of sequence of atom names
>    sequence of sequence of integer names

Yes, they are all syntactically correct, but each has a different semantics.

  object names -- Can be assigned with anything.
  sequence names -- Can only be assigned with a sequence.
  sequence of sequence names -- Can only contain sequences.
  sequence of sequence of object names -- same as above.
  sequence of sequence of atom names -- Can only contain sequences, which
                                      -- can only contain atoms
  sequence of sequence of integer names -- Can only contain sequences, which
                                      -- can only contain integers

If this is too much for some people to grok then maybe a simplified 'type' alias
might be useful.

   type word_list (sequence of sequence of integer)
   end type
   
> and maybe even
>    object of sequence names
>    object of sequence of object names
>    object of sequence of atom names
>    object of sequence of integer names

Well, the above would not be valid as they don't start with "sequence".

 
> or
>    sequence of object names
>    sequence of object of object names
>    sequence of object of atom names
>    sequence of object of integer names

However, 'sequence' by itself is already an abbreviation for 'sequence of
objects'.

> This is very confusing, especially for beginners, and has IMHO nothing
> got to do with the spirit of Euphoria.

If its the wordiness that worries you then we can solve that with an alias
mechanism. And exactly what is "the spirit of Euphoria"?
 
> That's why Pete Lomax suggested to restrict the new syntax to the
> definition of types. Then w'd have to create a user-defined type say
> "word_list", and in our programs we just say:
>    word_list names

Like the simplified alias syntax I suggested above?

> I'm strongly against the introduction of the new type syntax without
> this restriction.

I don't really think that this concept, which is used in other languages, is all
that baffling to newbies and oldbies alike.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu