Re: [POLL] Typing elements within a Type

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

Peter Robinson wrote:
> 1. Do you support the introduction of syntax in one of the following forms to
> allow a programmer to declare the types of elements within a user-defined type
> based on a sequence?
> [ANSWER YES OR NO]
> 
> Variation A1:
> 
> type customer( sequence x )
>    fields
>       integer x[1]
>       sequence x[2]
>       sequence x[3]
>    end fields
>    -- insert other code here
> end type
> 
> 
> Variation B1:
> 
> type customer( sequence x )
>    fields
>       integer  -- x[1] is assumed
>       sequence -- x[2] is assumed
>       sequence -- x[3] is assumed
>    end fields
>    -- insert other code here
> end type

NO
 
> 2. Regardless of your answer to the previous question:-
> 
>    (a)   which variation do you prefer? {ANSWER A1 or B1]

B1
 
>    (b)   would you support the introduction of both together?
>          [ANSWER YES OR NO]

NO
 
> 3. Regardless of your previous answers, do you support the introduction of
> syntax
> of the same kind but with naming of elements, like this:
> [ANSWER YES or NO]
> 
> Variation A2:
> 
> type customer( sequence x )
>    fields
>       integer  x[1] id
>       sequence x[2] name
>       sequence x[3] address
>    end fields
>    -- other code here
> end type
> 
> 
> Variation B2:
> 
> type customer( sequence x )
>    fields
>       integer  id       -- x[1] is assumed
>       sequence name     -- x[2] is assumed
>       sequence address  -- x[3] is assumed
>    end fields
>    -- other code here
> end type

MAYBE 
 
> 4. Regardless of your answer to the previous question:-
> 
>    (a)   which variation do you prefer? {ANSWER A2 or B2]

B2
 
>    (b)   would you support the introduction of both together?
>          [ANSWER YES OR NO]

NO
 
> 5. Regardless of your previous answers, if syntax with naming were introduced,
> would you prefer the elements in an object declarded with this type to be
> accessible
> by:- [ANSWER a or b]
> 
>    (a)   dot access e.g. customer_x.name; or
> 
>    (b)   subscript/indexes e.g. customer_x[name]

NOT SURE
 
> 6. Regardless of your previous answers, if such syntax were introduced (with
> or without naming), would you prefer it to imply: [ANSWER a or b]
>    
>    (a)   length(x) = 3 -- the interpreter would enforce this
> 
>          -- or merely
> 
>    (b)   length(x) >= 3?
> 

NOT SURE

> COMMENTS:

Adding a new run-time type to the backend for "structures",
along with integers, doubles, and sequences, 
would be prohibitively expensive, as I've stated
many times before, however it might be a good thing to
allow some syntactic way to declare structure types 
in the front end, with names and types of members specified, 
and optional type-checking by the interpreter, as long as a 
structure is just an ordinary sequence as far as the 
backend is concerned.

However, I think we should probably implement the 
"sequence of integer", etc. enhancement, and try it out 
for a while, before we try to firmly decide on the 
syntax for structure types with naming of fields, scope rules etc. 

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu