<span class="gmail_quote"></span>My 2 bits on this....<br>
<br>
<br>
I don't really care much about them, as I don't plan to use them, but
if "forced to use libraries that depend on keywords" means that they'll
show up in the API of the libs, I see this as a bad thing. Plus
if people who have not seen this discussion will have to insert #k-
when writing R5RS code, and the reason for the #k- is not obvious,
that'd also be bad. <br>
<br>
So at this point I'm againt it. I'm looking for the value though. If the motive is to do something like:<span class="q"><br>
<br>
> (send-mail From: "Dr. Watson <<a href="mailto:guest@grimpen.moor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">guest@grimpen.moor</a>>"<br>
> To: "Sherlock Homes <<a href="mailto:not-really@221B-baker.street" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">not-really@221B-baker.street</a>>"<br>
> Subject: "First Report"<br>
> Charset: "ISO-8859-1"<br>
> Body: "Moor is gloomy. Heard strange noise, attached."<br>
> Attachments: '((File: "howl.ogg")))<br>
<br>
<br></span>
This could be done in R5RS like:<span class="q"><br>
<br>
(send-mail `(From: ,"Dr. Watson <<a href="mailto:guest@grimpen.moor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">guest@grimpen.moor</a>>")<br>
`(To: ,"Sherlock Homes <<a href="mailto:not-really@221B-baker.street" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">not-really@221B-baker.street</a>>")<br>
`(Subject: ,"First Report")<br>
`(Charset: ,"ISO-8859-1")<br>
`(Body: ,"Moor is gloomy. Heard strange noise, attached.")<br></span>
`(Attachments: ,'((File: "howl.ogg"))))<br>
<br>
And with a wrapper macro could become:<span class="q"><br>
<br>
(send-mail [From: "Dr. Watson <<a href="mailto:guest@grimpen.moor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">guest@grimpen.moor</a>>"]<br>
[To: "Sherlock Homes <<a href="mailto:not-really@221B-baker.street" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">not-really@221B-baker.street</a>>"]<br>
[Subject: "First Report"]<br>
[Charset: "ISO-8859-1"]<br>
[Body: "Moor is gloomy. Heard strange noise, attached."]<br></span>
[Attachments: '((File: "howl.ogg"))])<br>
<br>
So it seems that we've saved 2 charactors (the #\[ and #\]) for a
keyword, but technically we don't need the #\: anymore. So if we
are looking for keystroke savings there is some, but that can't be what
this is all about.<br>
<br>
Matt mentions standardization, which is a good thing, but we could just
write a notation style. I wonder if there's any kind of hint that
could be added as warning message to the interpreter/compiler...<br>
<br>
Is there any need for keywords outside of pattern matching in syntactic forms that i'm not seeing?<br>
<br>
If it does happen, remember to change the drscheme parser to color the
keywords differntly to show that they are special, and not normal
syntax.<br><span class="sg">
<br>
<br>
Corey</span><div><span class="e" id="q_106b1fe7d7d42900_8"><br>
<br><br><div><span class="gmail_quote">On 10/1/05, <b class="gmail_sendername">Matthew Flatt</b> <<a href="mailto:mflatt@cs.utah.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mflatt@cs.utah.edu
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
With version 299.403, we plan to add keywords to MzScheme. Keywords are<br>self-quoting, symbol-like values that can be used for keyword-based<br>optional arguments.<br><br>For now, we've settled on colon-prefixed keywords --- which means that
<br>a symbol or identifier can't start with an unquoted colon:<br><br> (keyword? :a) ; => #t<br> (eq? :a ':a) ; => #t<br> (keyword? ':a) ; => #t<br> (keyword? 'a) ; => #f<br> (keyword? ':|a b|) ; => #t
<br> (keyword? '|:a b|) ; => #f<br> (keyword? :) ; => #t<br><br> (symbol? :a) ; => #f<br> (symbol? :) ; => #f<br><br> (lambda (:x) 10) ; => syntax error: :x is not an identifier<br><br><br>Pros:<br>
<br> * Self-quoting keywords support keyword-based optional arguments with<br> a relatively standard syntax.<br><br> * Syntactic forms can also use keywords, and pattern matching "just<br> works". Using keywords can help clarify when a syntactic form
<br> expects to match literals (e.g., the colon in a `compound-unit/sig'<br> form) versus bindings (e.g., `quasiquote' in a `match' pattern).<br><br> * Some people like the idea of keywords, and they'll put them to good
<br> use.<br><br>Cons:<br><br> * R5RS allows a colon at the beginning of a symbol/identifier, and<br> some of our code uses identifiers that start with a colon. Adding<br> keywords of this form is a significant backward-incompatible change.
<br><br> * Some people dislike the idea of keywords, and they'll be forced to<br> use libraries that depend on keywords.<br><br>To help port code, `#k-' can be used in front of an S-expression to<br>disable keywords, just like `#ci' selects case-insensitive parsing. For
<br>example, if a module uses colon-prefixed identifiers/symbols and the<br>module does not need keywords, then it can be prefixed with `#k-'.<br>Naturally, `#k+' would enable keyword parsing, so `#k+:apple' is always<br>
the keyword `:apple'.<br><br><br>Assuming that we add keywords to MzScheme, a MzLib library will quickly<br>follow for defining procedures with keyword-based arguments. MzScheme's<br>built-in `lambda' and `case-lambda' will not change.
<br><br><br>Among the people that I've polled so far, this plan has been relatively<br>uncontroversial; discussion quickly turns to the best uses keywords,<br>instead of whether they should exist or how they should be written. So
<br>I'm broadening the poll here...<br><br>Opinions?<br><br><br>Matthew<br><br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
</a><br></blockquote></div><br>
</span></div>