[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Re: Updated objc-header.scm
From: |
Kon Lovett |
Subject: |
[Chicken-users] Re: Updated objc-header.scm |
Date: |
Tue, 13 Jun 2006 12:51:16 -0700 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jun 13, 2006, at 12:31 PM, Zbigniew wrote:
Kon,
I've been away for a bit and am just now catching up on my email
backlog. It looks like a interesting idea. However, I'm curious why
you made NSString* and so on into macros that generate 'objc:ID etc.,
instead of using variables. In other words:
#;2> (define objc:NSString* objc:ID)
#;3> (define-objc-class ABCD NSObject ()
(+ NSString* hello
(print "hi")
"ooga"))
#;4> (@ ABCD hello)
hi
@"ooga"
#;5>
Is this approach workable? Do you want the extra parens to emulate
the look of Objective C, or find the macros are necessary?
Emulate the look of obj-c. Variables are fine too.
(- NSData* ((#:dataOfType NSString* aType) (#:error NSError**
outerr))
As an aside, the function macro:type->encoding provides some control
over this conversion; the default behaviour---prepend objc: to
symbols, pass the rest through---allows you to evaluate functions or
pass encoded typestrings directly. It is possible to augment this to
provide alternate syntax, for example when you pass a list; your
macros do effectively the same job, with just a bit of namespace
pollution.
In practice, a lot of namespace pollution. The set I defined is
popular but a real app would have lots of these things. Some other
method is preferable.
The only qualm I have about allowing type-like symbols instead of
plain ID and PTR is that it gives the erroneous impression of
typechecking, whereas ID and PTR spell this out. I guess it comes
down to user preference and, ultimately, can be loaded if the user so
desires.
I wanted them to remind me what was coming in & going out,
documentation really.
<snip>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEjxc0JJNoeGe+5O4RAn4AAJ94+4HQPNFcDurRlrDSjIUx/+YJSwCfcDRT
YIIBSBa64KoYCZXZfq2uuII=
=Y9fY
-----END PGP SIGNATURE-----