Re: Call for Opinions
Juergen Luethje wrote:
>
> Matt Lewis wrote:
>
> > Juergen Luethje wrote:
>
> <snip>
>
> >> BTW: I believe we can use OOEU as procedural language if we want,
> >> without using any OOP, and just use the other features.
> >> Is this right?
> >>
> >
> > Yes. In fact (and partially in response to your matrix), you could use
> > the OO features as structures (both in the logical and machine dependent,
> > c-structures). Here's the start of a lib (and a simple demo) for doing
> > that:
>
> Cool! Thanks.
> Although I maybe slowly get a "feeling" for OOP, I wonder whether I ever
> will actually understand it ...
>
> > }}}
<eucode>
> > -----------------------------------------------------
> > -- begin cstructs.e
> > -- Structure library for OOEU
> > include machine.e
> >
> > global euclass Byte( integer b )
> > procedure Store( atom ptr )
> > poke( ptr, this )
> ^^^^
> ... for instance, what does "this" mean.
> I also saw it in OOEU example programs, but couldn't find an explanation.
>
> <snip>
>
> > ----------------------------------------------------------
> > -- begin struct.ex
> > include cstructs.e
> >
> > euclass MyStruct( CStruct s )
> > Long a_long
> > Lpsz a_string
> >
> > procedure Poke()
> > atom ptr
> > ptr = this.ptr
> > this.a_long.Store( ptr )
> > ptr += this.a_long.sizeof()
> > this.a_string.Store( ptr )
> > end procedure
> >
> > function Peek()
> > atom ptr
> > ptr = this.ptr
> > this.a_long = this.a_long.Fetch( ptr )
> > ptr += this.a_long.sizeof()
> > this.a_string = this.a_string.Fetch( this.ptr )
> > return this
> > end function
> >
> > procedure New( atom l, sequence str )
> > this = repeat( 0, MyStruct.a_string )
> > this.size = Long.size + Lpsz.size
> > this.ptr = this.Alloc()
> > this.a_long = l
> > this.a_string = str
> > this.Poke()
> > end procedure
> > end euclass
> >
> > MyStruct struct
> >
> > struct = MyStruct.New( 0, 0, "Hello, World" )
>
> Another point that I don't understand:
> 'MyStruct.New()' is declared with 2 parameters, but here you call it
> with 3 parameters ...
>
> > struct.Poke()
> > ? struct
> > ? peek( struct )
> > poke4u( struct.ptr, 1 )
> > struct = struct.Peek()
> > ? struct
> >
> > -- end struct.ex
> > ---------------------------------------
> <font color="#330033">> </eucode>
{{{
</font>
>
> Thanks in advance for some help.
> Regards,
> Juergen
>
>
The structure library that I include with VEEU, can work on any 100% campatable
Euphoria interpreters.. And it also offers full support for C/C++ unions, arrays,
and all types. I had to modify it to work standalone without Chris's Empire
framework, plus did some other modifications & optimizations.
I'm planning on a binder/shrouder program.. and possibly an IL dissasembler for
the next release. Matt's interpreter has an GUI based trace screen module, that
is really cool. My next release will also have a better versioning system. Right
now it is just v2.5 (like Euphoria :P).
Regards,
Vincent
--
Without walls and fences, there is no need for Windows and Gates.
|
Not Categorized, Please Help
|
|