Re: [dylan] Mindy: Surface syntax

Stefan Edwards <[email protected]> Mon, 2 Nov 2015 08:59:38 -0500
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CAEMRNFMHNCuMaV4kKiy8YHbwkwYAfo0r2wkt_tz_Ao6pp=ec0w@mail.gmail.com>
--===============1809336110==
Content-Type: multipart/alternative; boundary=001a113f000c276c6c05238f308c

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

I think the () around certain forms, like `if`, are fair game for removal
if there's some other visual representation that you're in a block. Lua has
if-then, python has ':', &c. If the syntax is relatively clean, people will
accept all kinds of craziness (witness Go, which doesn't even have all the
features of Limbo :|).

I think if you can get the Ruby-style of matching { to }, and begin to end,
people can mix and match as they please. I agree tho: breaking DExprs'
ability to be homoiconic & expandable would defeat one of the very central
purposes to using Dylan to begin with. Luckily there are quite a few
languages out there with {}-style that also have macros, so I don't think
this is an enormous task. Of course, this is all just my =C2=A30.02, since =
I'd
prefer straight SExprs anyway :D


On Mon, Nov 2, 2015 at 5:47 AM, Bruce Hoult <[email protected]> wrote:

> 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 fo=
r
> // 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]=
m
> > 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 ne=
w
>> surface syntax to Mindy. This could be a pilot project for perhaps apply=
ing
>> 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> =3D> (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) =3D False
>> IsClass cl (c::cs) =3D
>>    if cl =3D 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
>>
>>
>
> _______________________________________________
> hackers mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/hackers
>
>


--=20
=3D=3D=3D=3D
Q. How many Prolog programmers does it take to change a lightbulb?
A. No.

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

<div dir=3D"ltr">I think the () around certain forms, like `if`, are fair g=
ame for removal if there&#39;s some other visual representation that you&#3=
9;re in a block. Lua has if-then, python has &#39;:&#39;, &amp;c. If the sy=
ntax is relatively clean, people will accept all kinds of craziness (witnes=
s Go, which doesn&#39;t even have all the features of Limbo :|).<div><br></=
div><div>I think if you can get the Ruby-style of matching { to }, and begi=
n to end, people can mix and match as they please. I agree tho: breaking DE=
xprs&#39; ability to be homoiconic &amp; expandable would defeat one of the=
 very central purposes to using Dylan to begin with. Luckily there are quit=
e a few languages out there with {}-style that also have macros, so I don&#=
39;t think this is an enormous task. Of course, this is all just my =C2=A30=
.02, since I&#39;d prefer straight SExprs anyway :D</div><div><br></div></d=
iv><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Nov 2,=
 2015 at 5:47 AM, Bruce Hoult <span dir=3D"ltr">&lt;<a href=3D"mailto:bruce=
@hoult.org" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr">I really like the existing synt=
ax! The main thing I&#39;d change is to remove the compulsory ( ) around th=
e test in ifs and loops. <a href=3D"http://i.e.be" target=3D"_blank">i.e.be=
</a> more like Pascal/Modula2/Ada.<div><br></div><div>However, the market o=
f ideas seems to have largely decided that serious programming languages ne=
ed not only those parens, but also { } around blocks :(</div><div><br></div=
><div>It might be interesting to see if a more Java-like syntax could be de=
veloped. Preferably with a way to retain the functionality of &quot;end met=
hod&quot;, &quot;end foo&quot;, &quot;end method foo&quot; etc. Maybe have =
a standard format for // comments after a } and check them for consistency =
if they are present?</div><div><br></div><div>Inventing a syntax and someho=
w parsing it is not a difficult task. The difficult task is to make the syn=
tax 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.</div><div><br></div></div><div class=3D"gmail_extra"><br>=
<div class=3D"gmail_quote"><div><div class=3D"h5">On Mon, Nov 2, 2015 at 4:=
08 AM, Bruce Mitchener <span dir=3D"ltr">&lt;<a href=3D"mailto:bruce.mitche=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> w=
rote:<br></div></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class=3D"h5">=
<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" target=3D"_blank">https://github.com/waywardmonkeys/prefixy-=
dylan-notes/blob/master/source/index.rst</a></div><div><br></div><div>It mi=
ght be interesting to think a bit broader than this though and look at some=
 other options:</div><div><br></div><div><ul><li>Something ML inspired? Wha=
t might this look like?<br></li><li>Something inspired by Pyret (<a href=3D=
"http://www.pyret.org/" target=3D"_blank">http://www.pyret.org/</a>)?</li><=
li>???</li></ul><div>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 o=
f parentheses.</div></div><div><br></div><div>One way to address that is to=
 do what Goo did:</div><div><br></div><blockquote style=3D"margin:0px 0px 0=
px 40px;border:none;padding:0px"><div><div>(dm floor/ (real|&lt;num&gt; div=
isor|&lt;num&gt; =3D&gt; (tup x|&lt;int&gt; rem|&lt;num&gt;))</div></div><d=
iv><div>=C2=A0 ...)</div></div></blockquote><div><br></div><div>or like Mik=
el Evins did in Bard:</div><div><br></div><blockquote style=3D"margin:0px 0=
px 0px 40px;border:none;padding:0px"><div><div>(define (signature-more-spec=
ific? 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 (every subtype? s1:types s2:types)))</div></div></=
blockquote><div><br></div><div>Another way would be to take the approach of=
 Typed Racket and move the type 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>(define (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-lst)</div></div><div><div>=C2=A0 =C2=A0 =C2=A0 (l=
ength str-or-lst)))</div></div></blockquote><div><br></div><div>As for an M=
L-like syntax, a very long time ago, there was an article on the semantics =
of Dylan that used an ML-like syntax:</div><div><br></div><blockquote style=
=3D"margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>IsClass :: C=
lassName -&gt; ClassList -&gt; Boolean</div></div><div><div>IsClass (cl:Cla=
ssName) ([]: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" t=
arget=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 h=
ere:=C2=A0<a href=3D"https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai=
/lang/others/dylan/doc/semantic/0.html" target=3D"_blank">https://www.cs.cm=
u.edu/afs/cs/project/ai-repository/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 Fortress.</div><div><br></div><div>Discussion and=
 thoughts welcome!</div><span><font color=3D"#888888"><div><br></div><div>=
=C2=A0- Bruce</div><div><br></div></font></span></div></div></div><span cla=
ss=3D"HOEnZb"><font color=3D"#888888"><span><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></font></span><span class=3D"">__________________________=
_____________________<br>
hackers mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">hackers@li=
sts.opendylan.org</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></span></blockquote></div><br></div>
<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><br clear=3D"all"><div><br></div>-- <br><div cla=
ss=3D"gmail_signature">=3D=3D=3D=3D<br>Q. How many Prolog programmers does =
it take to change a lightbulb?<br>A. No.</div>
</div>

--001a113f000c276c6c05238f308c--

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

--===============1809336110==--