I'll use USING usually (puns intended) no more than once in a
definition. Otherwise [OBJECTS ... OBJECTS] is a better choice.
This does the same thing as your def using MAKES (but I suspect you're
looking for something more):
: def2 ( -- ) \ Assumes Foo is defined as below
[OBJECTS Foo MAKES BAR OBJECTS]
BAR member @ BAR member ! ;
Often a Windows API call returns a structure. For example, a
notification message returns a structure NMHDR pointed to by LPARAM.
Using NAMES, we can access the structure like this:
: MY-NOTIFICATION ( -- )
LPARAM [OBJECTS NMHDR NAMES NM OBJECTS]
NM code @ ( notify code )
NM idFrom @ ( CntlId# )
do-something ;
Hope this helps,
Mike
-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf
Of Roger Levy
Sent: Friday, September 26, 2008 10:38 PM
To: sftalk_at_forth.com
Subject: [sftalk] SWOOP idea
What would be really nice is a way of hiding USING by making a sort of
typed
VALUE ...
I thought I might try to create that, calling it a HOLDER, but it seems
too
hard to do myself.
Example:
[code]
Class Foo
...
End-Class
Foo Holder Bar
: def
FOO NEW TO BAR
BAR member @ BAR member ! ;
[/code]
Now BAR would behave like a typed VALUE in that we can store an address
into
it with TO, but when called it acts like an object of type FOO. Much
better
than constantly calling USING or using slow CALLING/->
What does everyone think?
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sat Sep 27 2008 - 08:03:30 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 07-Feb-2012. Archive updated nightly.