Re: Euphoria types of the POLL

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

I have another idea, not releated to the the question though.
maybee rob should consider something like this:
-- define some standard euphoria types

type myInteger  (integer i)  return integer (i) end type
type myAtom     (atom a)     return atom    (a) end type
type mySequence (sequence s) return sequence(s) end type

-- now here's the idea

global record myArray     -- create a namespace called myArray

    age   as myInteger    -- define some fields for da myArray
    name  as mySequence
    other as myAtom

end record

-- now myArray could be accessed like this with full typecheck

    myArray:name = "Hayden" -- assign some variables
    myArray:age  = 28

    ? myArray:name          -- print them to screen
    ? myArray:age


footnotes:
    Labels defined inside the record should be private, that means that
    access to record variables like so would be illegal...
    ? myArray[1]    -- should generate an illegal error
    ? myArray[name] -- should generate an illegal error

    name = 1        -- generate attempt to redefine 'name' error


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

Search



Quick Links

User menu

Not signed in.

Misc Menu