Re: [dylan] Mindy: Surface syntax

Bruce Hoult <[email protected]> Mon, 2 Nov 2015 13:47:50 +0300
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CAMU+EkwHaU7uzMehEbt+-QNc=eYOaH8ccXCaiGGwQH39QdJP4A@mail.gmail.com>
--===============1950438542==
Content-Type: multipart/alternative; boundary=001a11c22ac83a84da05238c82b0

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

I really like the existing syntax! The main thing I'd change is to remove
the compulsory ( ) around the test in ifs and loops. i.e.be more like
Pascal/Modula2/Ada.

However, the market of ideas seems to have largely decided that serious
programming languages need not only those parens, but also { } around
blocks :(

It might be interesting to see if a more Java-like syntax could be
developed. Preferably with a way to retain the functionality of "end
method", "end foo", "end method foo" etc. Maybe have a standard format for
// comments after a } and check them for consistency if they are present?

Inventing a syntax and somehow parsing it is not a difficult task. The
difficult task is to make the syntax one that is friendly to defining
powerful macros. And in particular, to continuing to define most of the
standard surface syntax as macros in the standard library.


On Mon, Nov 2, 2015 at 4:08 AM, Bruce Mitchener <[email protected]>
wrote:

> 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
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
> _______________________________________________
> hackers mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/hackers
>
>

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

<div dir=3D"ltr">I really like the existing syntax! The main thing I&#39;d =
change is to remove the compulsory ( ) around the test in ifs and loops. <a=
 href=3D"http://i.e.be">i.e.be</a> more like Pascal/Modula2/Ada.<div><br></=
div><div>However, the market of ideas seems to have largely decided that se=
rious programming languages need not only those parens, but also { } around=
 blocks :(</div><div><br></div><div>It might be interesting to see if a mor=
e Java-like syntax could be developed. Preferably with a way to retain the =
functionality of &quot;end method&quot;, &quot;end foo&quot;, &quot;end met=
hod foo&quot; etc. Maybe have a standard format for // comments after a } a=
nd check them for consistency if they are present?</div><div><br></div><div=
>Inventing a syntax and somehow parsing it is not a difficult task. The dif=
ficult task is to make the syntax one that is friendly to defining powerful=
 macros. And in particular, to continuing to define most of the standard su=
rface syntax as macros in the standard library.</div><div><br></div></div><=
div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Nov 2, 201=
5 at 4:08 AM, Bruce Mitchener <span dir=3D"ltr">&lt;<a href=3D"mailto:bruce=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</=
span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">As usual wh=
enever Dylan gets much attention, the subject of the syntax comes up.<div><=
br></div><div>As such, we&#39;re interested in entertaining a discussion ab=
out adding a new surface syntax to Mindy. This could be a pilot project for=
 perhaps applying it to Open Dylan in the future.</div><div><br></div><div>=
Long ago, I had started some notes about various similar syntax options:</d=
iv><div><br></div><div>=C2=A0 =C2=A0=C2=A0<a href=3D"https://github.com/way=
wardmonkeys/prefixy-dylan-notes/blob/master/source/index.rst" target=3D"_bl=
ank">https://github.com/waywardmonkeys/prefixy-dylan-notes/blob/master/sour=
ce/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:</div><div><b=
r></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/" targ=
et=3D"_blank">http://www.pyret.org/</a>)?</li><li>???</li></ul><div>One com=
mon 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.</div></div><d=
iv><br></div><div>One way to address that is to do what Goo did:</div><div>=
<br></div><blockquote style=3D"margin:0px 0px 0px 40px;border:none;padding:=
0px"><div><div>(dm floor/ (real|&lt;num&gt; divisor|&lt;num&gt; =3D&gt; (tu=
p x|&lt;int&gt; rem|&lt;num&gt;))</div></div><div><div>=C2=A0 ...)</div></d=
iv></blockquote><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;padd=
ing:0px"><div><div>(define (signature-more-specific? s1::TypeSignature s2::=
TypeSignature)</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 (ev=
ery subtype? s1:types s2:types)))</div></div></blockquote><div><br></div><d=
iv>Another way would be to take the approach of Typed Racket and move the t=
ype annotations out of the signature:</div><div><br></div><blockquote style=
=3D"margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>(: flexible-=
length (-&gt; (U String (Listof Any)) Integer))</div></div><div><div>(defin=
e (flexible-length str-or-lst)</div></div><div><div>=C2=A0 (if (string? str=
-or-lst)</div></div><div><div>=C2=A0 =C2=A0 =C2=A0 (string-length str-or-ls=
t)</div></div><div><div>=C2=A0 =C2=A0 =C2=A0 (length str-or-lst)))</div></d=
iv></blockquote><div><br></div><div>As for an ML-like syntax, a very long t=
ime ago, there was an article on the semantics of Dylan that used an ML-lik=
e syntax:</div><div><br></div><blockquote style=3D"margin:0px 0px 0px 40px;=
border:none;padding:0px"><div><div>IsClass :: ClassName -&gt; ClassList -&g=
t; Boolean</div></div><div><div>IsClass (cl:ClassName) ([]:ClassList) =3D F=
alse</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" target=3D"_blank">c.name</a> =
then True else IsClass cl ... =C2=A0 =C2=A0=C2=A0</div></div></blockquote><=
div><br></div><div>That article can be found here:=C2=A0<a href=3D"https://=
www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/others/dylan/doc/semant=
ic/0.html" target=3D"_blank">https://www.cs.cmu.edu/afs/cs/project/ai-repos=
itory/ai/lang/others/dylan/doc/semantic/0.html</a></div><div><br></div><div=
>There&#39;s probably room to look at some of what Cecil did as well as For=
tress.</div><div><br></div><div>Discussion and thoughts welcome!</div><span=
 class=3D"HOEnZb"><font color=3D"#888888"><div><br></div><div>=C2=A0- Bruce=
</div><div><br></div></font></span></div><span class=3D"HOEnZb"><font color=
=3D"#888888">
<br>--=20
<br>This message has been scanned for viruses and
<br>dangerous content by
<a href=3D"http://www.mailscanner.info/" target=3D"_blank"><b>MailScanner</=
b></a>, and is
<br>believed to be clean.

</font></span><br>_______________________________________________<br>
hackers mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]<=
/a><br>
<a href=3D"https://lists.opendylan.org/mailman/listinfo/hackers" rel=3D"nor=
eferrer" target=3D"_blank">https://lists.opendylan.org/mailman/listinfo/hac=
kers</a><br>
<br></blockquote></div><br></div>

--001a11c22ac83a84da05238c82b0--

--===============1950438542==
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

--===============1950438542==--