[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What?
In article <003f01c246ec$6f8bbc10$be8cfd3e@wilde>,
"Jason Trenouth" <jason.trenouth@bigfoot.com> wrote:
> BTW I noticed this embedded citation but I wasn't sure who said it
> (Andreas?):
This was my comment. ;-)
> > >>> I can understand that Dylan does no longer follow above ideas and
> > >>> tries to be compatible with the mainstream.
>
> Anyway I just wanted to say that perhaps Dylan didn't go far enough for the
> "mainstream". From comments I've seen on code that compares Java to Dylan,
> "mainstream" folks don't like the 'flashing neon' of Dylan's use of
> punctuation symbols.
Don't forget that at Apple's time mainstream also meant
Object Pascal. Many applications on the Mac were written
in it, especially using MacApp. Then it was C++. Now
it is Objective C.
It is especially funny that Apple left mainstream by using
Objective C (and not C++ and not Java) for some of their
core applications. Now Objective C with its Smalltalkish
object system is was Dylan could have been. Sigh.
Again, Lisp adapts to this situation. Gary Byers
has written some nice integration code for OpenMCL. An
example - now you can use something like Objective C's
message passing syntax in Lisp code:
(defun create-text-attributes (&key (font (default-font))
(line-break-mode :char)
(color nil))
(let* ((dict [[[(@class "NSMutableDictionary") "alloc"]
"initWithCapacity:" :unsigned (if color 3 2)]
"retain"]))
[dict "setObject:forKey:"
:id (create-paragraph-style font line-break-mode)
:id #@"NSParagraphStyle"]
[dict "setObject:forKey:" :id font :id #@"NSFont"]
(when color
[dict "setObject:forKey:" :id color :id #@"NSColor"])
dict))
And create classes, of course:
(def-objc-class "lispeditordocument" "NSDocument"
((textview "textView") :id)
filedata
packagename
echoarea)
<..>
> Of course, much of this is down to convention. If Dylan were to adopt more
> conventional conventions (!) for identifiers then the same code might look
> like this: :-)
>
> define method sumStream ( stream :: Stream ) => ( s :: Integer )
> let sum :: Integer = 0;
> let n :: falseOr( String ) = #f;
> while ( n := readLine( stream, onEndOfStream: #f ) )
> sum := sum + stringToInteger( n );
> end;
> sum
> end method;
I always wondered whether it would be defineMethod instead of
define method ??
defineMethod sumStream ( stream :: Stream ) => ( s :: Integer )
let sum :: Integer = 0;
let n :: falseOr( String ) = #f;
while ( n := readLine( stream, onEndOfStream: #f ) )
sum := sum + stringToInteger( n );
end;
sum
endMethod;
> Still more than the Java example, but at least the punctuation is no longer
> in identifiers. (Yes I know Dylan is case-insensitive...)
It could be case-insensitive, but "case-preserving".
> I'm not seriously suggesting any change, but I just wanted to say that Dylan
> fell short of wrapping Lisp in a "mainstream" syntax.
I'm not really sure there is only one mainstream syntax - C is
very influential, though.
- Follow-Ups:
- Re: What?
- From: Duane Rettig <duane@franz.com>