[dylan] Mindy: Surface syntax

Bruce Mitchener <[email protected]> Mon, 2 Nov 2015 08:08:21 +0700
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CA+esKjP295a0vEfW25qmkkuHjuf6bzmCGW0XZTsFPLETTCu7Eg@mail.gmail.com>
--===============0183402433==
Content-Type: multipart/alternative; boundary=001a1134bae0d17e3005238469f8

--001a1134bae0d17e3005238469f8
Content-Type: text/plain; charset=UTF-8

As usual whenever Dylan gets much attention, the subject of the syntax
comes up.

As such, we're interested in entertaining a discussion about adding a new
surface syntax to Mindy. This could be a pilot project for perhaps applying
it to Open Dylan in the future.

Long ago, I had started some notes about various similar syntax options:


https://github.com/waywardmonkeys/prefixy-dylan-notes/blob/master/source/index.rst

It might be interesting to think a bit broader than this though and look at
some other options:


   - Something ML inspired? What might this look like?
   - Something inspired by Pyret (http://www.pyret.org/)?
   - ???

One common complaint about prefix-dylan syntax (shared by Scott McKay a few
hours ago on Twitter as well) is that it uses a lot of parentheses.

One way to address that is to do what Goo did:

(dm floor/ (real|<num> divisor|<num> => (tup x|<int> rem|<num>))
  ...)


or like Mikel Evins did in Bard:

(define (signature-more-specific? s1::TypeSignature s2::TypeSignature)
  (if (eqv? s1 s2)
      #t
      (every subtype? s1:types s2:types)))


Another way would be to take the approach of Typed Racket and move the type
annotations out of the signature:

(: flexible-length (-> (U String (Listof Any)) Integer))
(define (flexible-length str-or-lst)
  (if (string? str-or-lst)
      (string-length str-or-lst)
      (length str-or-lst)))


As for an ML-like syntax, a very long time ago, there was an article on the
semantics of Dylan that used an ML-like syntax:

IsClass :: ClassName -> ClassList -> Boolean
IsClass (cl:ClassName) ([]:ClassList) = False
IsClass cl (c::cs) =
   if cl = c.name then True else IsClass cl ...


That article can be found here:
https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/others/dylan/doc/semantic/0.html

There's probably room to look at some of what Cecil did as well as Fortress.

Discussion and thoughts welcome!

 - Bruce

--001a1134bae0d17e3005238469f8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As usual whenever Dylan gets much attention, the subject o=
f the syntax comes up.<div><br></div><div>As such, we&#39;re interested in =
entertaining a discussion about adding a new surface syntax to Mindy. This =
could be a pilot project for perhaps applying it to Open Dylan in the futur=
e.</div><div><br></div><div>Long ago, I had started some notes about variou=
s similar syntax options:</div><div><br></div><div>=C2=A0 =C2=A0=C2=A0<a hr=
ef=3D"https://github.com/waywardmonkeys/prefixy-dylan-notes/blob/master/sou=
rce/index.rst">https://github.com/waywardmonkeys/prefixy-dylan-notes/blob/m=
aster/source/index.rst</a></div><div><br></div><div>It might be interesting=
 to think a bit broader than this though and look at some other options:</d=
iv><div><br></div><div><ul><li>Something ML inspired? What might this look =
like?<br></li><li>Something inspired by Pyret (<a href=3D"http://www.pyret.=
org/">http://www.pyret.org/</a>)?</li><li>???</li></ul><div>One common comp=
laint about prefix-dylan syntax (shared by Scott McKay a few hours ago on T=
witter as well) is that it uses a lot of parentheses.</div></div><div><br><=
/div><div>One way to address that is to do what Goo did:</div><div><br></di=
v><blockquote style=3D"margin:0px 0px 0px 40px;border:none;padding:0px"><di=
v><div>(dm floor/ (real|&lt;num&gt; divisor|&lt;num&gt; =3D&gt; (tup x|&lt;=
int&gt; rem|&lt;num&gt;))</div></div><div><div>=C2=A0 ...)</div></div></blo=
ckquote><div><br></div><div>or like Mikel Evins did in Bard:</div><div><br>=
</div><blockquote style=3D"margin:0px 0px 0px 40px;border:none;padding:0px"=
><div><div>(define (signature-more-specific? s1::TypeSignature s2::TypeSign=
ature)</div></div><div><div>=C2=A0 (if (eqv? s1 s2)</div></div><div><div>=
=C2=A0 =C2=A0 =C2=A0 #t</div></div><div><div>=C2=A0 =C2=A0 =C2=A0 (every su=
btype? s1:types s2:types)))</div></div></blockquote><div><br></div><div>Ano=
ther way would be to take the approach of Typed Racket and move the type an=
notations out of the signature:</div><div><br></div><blockquote style=3D"ma=
rgin:0px 0px 0px 40px;border:none;padding:0px"><div><div>(: flexible-length=
 (-&gt; (U String (Listof Any)) Integer))</div></div><div><div>(define (fle=
xible-length str-or-lst)</div></div><div><div>=C2=A0 (if (string? str-or-ls=
t)</div></div><div><div>=C2=A0 =C2=A0 =C2=A0 (string-length str-or-lst)</di=
v></div><div><div>=C2=A0 =C2=A0 =C2=A0 (length str-or-lst)))</div></div></b=
lockquote><div><br></div><div>As for an ML-like syntax, a very long time ag=
o, there was an article on the semantics of Dylan that used an ML-like synt=
ax:</div><div><br></div><blockquote style=3D"margin:0px 0px 0px 40px;border=
:none;padding:0px"><div><div>IsClass :: ClassName -&gt; ClassList -&gt; Boo=
lean</div></div><div><div>IsClass (cl:ClassName) ([]:ClassList) =3D False</=
div></div><div><div>IsClass cl (c::cs) =3D</div></div><div><div>=C2=A0 =C2=
=A0if cl =3D <a href=3D"http://c.name">c.name</a> then True else IsClass cl=
 ... =C2=A0 =C2=A0=C2=A0</div></div></blockquote><div><br></div><div>That a=
rticle can be found here:=C2=A0<a href=3D"https://www.cs.cmu.edu/afs/cs/pro=
ject/ai-repository/ai/lang/others/dylan/doc/semantic/0.html">https://www.cs=
.cmu.edu/afs/cs/project/ai-repository/ai/lang/others/dylan/doc/semantic/0.h=
tml</a></div><div><br></div><div>There&#39;s probably room to look at some =
of what Cecil did as well as Fortress.</div><div><br></div><div>Discussion =
and thoughts welcome!</div><div><br></div><div>=C2=A0- Bruce</div><div><br>=
</div></div>

--001a1134bae0d17e3005238469f8--

--===============0183402433==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers

--===============0183402433==--