Re: Overcoming the "Dylan is Dead" belief?

Alexey Muranov <[email protected]> Fri, 14 Mar 2014 00:02:28 +0100
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <[email protected]>
> Date: Wed, 11 Sep 2013 01:20:15 -0400
> From: Carl Gay <[email protected]>
> To: Dylan Public Development List <[email protected]>
> Subject: Re: [hackers] Overcoming the "Dylan is Dead" belief?
> Message-ID:
> 	<CALekcH13N-sY+CCo4r19UvMbLyqTRrjZCVC=x5F+0SWXmiQYuQ@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> I've long wanted to make Dylan better for "scripting".  With the right
> libraries it could compete really well in that space, and then also have
> the added advantage of providing a smooth transition to the large projects
> that "scripts" often turn into.
> 
> Building out better OS interfaces has been on my list for a long while.
> 
> I thought some of the comments in
> http://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.htmlabout
> how they get most of their converts from languages like Python and
> Ruby rather than C++ were apropos.  I see Go as being in a similar space to
> Dylan, broadly speaking.
> 
> I'm sometimes tempted to change the name, but I feel like it would be
> artificial unless we did it because we changed the language significantly.
> New syntax, anyone?  :-)

I dare to propose here an alternative syntax, for whatever it is worth.  I kept thinking about it for a while, because having to type and to visually parse all the semicolons makes me reluctant to use Dylan for scripting.  This only reflects my personal taste, please feel free to ignore.

I have thought of something like this, for example:

//////////////////////////////////////////////////////////////////////////////

define class <vehicle> (<object>) {
  slot owner :: <string>,
    init-keyword: owner:,
    init-value: "Northern Motors" }

define class <car> (<vehicle>)

define class <truck> (<vehicle>) {
  slot capacity,
    required-init-keyword: tons: }

//////////////////////////////////////////////////////////////////////////////

define generic tax
  (v :: <vehicle>) => (tax-in-dollars :: <float>)

define method tax
  (v :: <vehicle>) => (tax-in-dollars :: <float>) {
  100.00 }

define method tax
  (c :: <car>) => (tax-in-dollars :: <float>) {
  50.0 }

define method tax
  (t :: <truck>) => (tax-in-dollars :: <float>) {
  // standard vehicle tax plus $10/ton
  next-method() + t.capacity * 10.0 }

//////////////////////////////////////////////////////////////////////////////

define function make-fibonacci() {
  let n = 0
  let m = 1
  method () {
    let result = n + m
    n <- m
    m <- result  // return value
    } }

define constant fib = make-fibonacci()

for (i from 1 to 15) {
  format-out("%d ", fib()) }

//////////////////////////////////////////////////////////////////////////////

Best,

Alexey.