[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What?



BTW I noticed this embedded citation but I wasn't sure who said it
(Andreas?):

> >>> 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.

Comparing Dylan and Java:

// Dylan
define method sum-stream ( stream :: <stream> ) => ( s :: <integer> )
  let sum :: <integer> = 0;
  let n :: false-or( <string> ) = #f;
  while ( n := read-line( stream, on-end-of-stream: #f ) )
    sum := sum + string-to-integer( n );
  end;
  sum
end method;

// Java (untested)
int sumStream ( BufferedReader reader ) throws IOException
{
  int sum = 0;
  String n = null;
  while ( ( n = reader.readLine() ) != null )
  {
    sum += String.parseInt( n );
  }
  return sum;
}

Mainstream programmers find the Java version less "busy" because it contains
fewer punctuation symbols that seem to be shouting at them (~ 50% less in
this example) . Of course, you get used to it and these visual cues are very
useful, but the first impression can be one of fussy clutter.

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;

Still more than the Java example, but at least the punctuation is no longer
in identifiers. (Yes I know Dylan is case-insensitive...)

I'm not seriously suggesting any change, but I just wanted to say that Dylan
fell short of wrapping Lisp in a "mainstream" syntax.

__Jason