Re: Euphoria pre-processor

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

>I like some features of OOP too, but Euphoria is *not* OOP, and to make
>it object-oriented would bloat it IMO; look at what happened to C++:
>procedural + OO functionality made for quite a large compiler.
>And if even a subset of OO was added to the interpreter, then it would
>create larger bound programs...

I agree that adding OO to the interperter would make it much larger. What I
ment was to convert an object-oriented version of Euphoria to the standard
version. The existing interperter works fine, but it is difucult to write
programs that use an object-oriented design in standard Euphoria because
you have to set up things like:

constant FIRST_NAME =3D 1, LAST_NAME =3D 2, E_MAIL =3D 3
type entry(sequence s)
        if length(s) =3D 3 then
return sequence(s[FIRST_NAME]) and sequence(s[LAST_NAME])       
                       and
sequence(s[E_MAIL])
        end if
        return 0
end type
entry me
me[FIRST_NAME] =3D "Jeffrey"
me[LAST_NAME] =3D "Fielding"
me[E_MAIL] =3D "JJProg at cyberbury.net"
-- etc...

However, using a pre-processor, you could write:
struct entry
        sequence first_name
        sequence last_name
        sequence e_mail
end struct
entry me
me.first_name =3D "Jeffrey"
me.last_name =3D "Fielding"
me.e_mail =3D "JJProg at cyberbury.net"
-- etc...

and the pre-processor would write the standard Euphoria code for you (and
possibly even optomize it).

Jeffrey Fielding
JJProg at cyberbury.net

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

Search



Quick Links

User menu

Not signed in.

Misc Menu