Re: C-like Structures

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...

I went with a very C-like syntax for declarations. A lot more so than my original posts. I've gotten some criticism for this, but I think it makes sense. These structures are useful for communicating with outside libraries, and when you run into structures, they're likely to be documented and implemented as C structs. So keeping close to C should make it easier for euphoria programmers to communicate with external libraries.

The data types are: char, short, int, long, long long, float, double long double, eudouble and object.

I agree that having familiar 'words' will help using this feature but I'm still of the mind that the 'datatypes' named above should have been defined in terms of memstruct constructs rather than hard coding them in the parser. My suggestion would only require two low level words, which would be used to define the number of physical bytes of RAM to assign to a memstruct label, and to optionally modify the type of access to fetch/store data into those bytes (eg. signed data).

For example, int could have been defined as ...

define memstruct int 
ifdef ARCH32 then 
    rambytes(4) x 
elsedef 
    rambytes(8) x 
end ifdef 
end memstruct 
then int could be used exactly as your examples.
define memstruct point 
   int X 
   int Y 
end memstruct 

I'm sure that this would simplify the parser and allow future 'predefined' data types to be much more easily built instead of updating the parser to cater for them.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu