[racket] Formal Presentation and initial doubts.
On Mar 22, 2014 3:44 AM, "Daniel Prager" <daniel.a.prager at gmail.com> wrote:
>
> > Does… CL have a pattern-based macro syntax like syntax-rules?
>
> Not buit-in.
>
> > If not, it seems surprising to argue that lisp macros would be easier
to learn. Can you give examples?
>
> The explanation of CL macros and their application in On Lisp seems more
accessible, for example, than anything I've been able to lay my hands on
for the syntax-rules/case/parse.
It has been mentioned already in this thread, but I think that Greg
Hendershott's Fear of Macros tutorial is by far the best here:
http://www.greghendershott.com/fear-of-macros/
In particular, it doesn't start with pattern matching, which is part of
what makes macros confusing to newcomers.
Sam
>
>
>
> On Sat, Mar 22, 2014 at 10:28 AM, John Clements <clements at brinckerhoff.org>
wrote:
>>
>>
>> On Mar 21, 2014, at 3:49 PM, Daniel Prager <daniel.a.prager at gmail.com>
wrote:
>>
>> > Thank-you for raising this topic.
>> >
>> > > I don't understand well its macros (are completely different for me
than CL macros).
>> >
>> > Me neither. And I'm somewhat torn. The trade-off as I understand it is
that CL-style macros are *much* easier to learn, but prone to aliasing
while hygenic macros are technically superior because they compose better
and you can't accidentally hit aliasing problems. But when it comes to
learning, the advantages are reversed.
>>
>> Does… CL have a pattern-based macro syntax like syntax-rules? If not, it
seems surprising to argue that lisp macros would be easier to learn. Can
you give examples?
>>
>> John Clements
>>
>> >
>> > William Byrd, in this 2012 interview with Michael Fogus, comments on
some of these issues:
>> > Clojure's macro system appears to me to be a kludge, trying to patch
up Common Lisp's defmacro without going all the way to real hygienic
macros. I don't mean to be overly critical--I'm not happy with the state of
Scheme, either, which has not one but two hygienic macro systems, neither
of which is ideal.
>> >
>> > The more powerful Scheme macro system, syntax-case, gives the
programmer the full power of Scheme at macro expansion time, along with the
ability to "bend" hygiene when desired. Syntax-case is powerful enough to
define Common Lisp's defmacro (and almost certainly powerful enough to
define Clojure's defmacro as well). Unfortunately, syntax-caseis
notoriously complicated. As far as I can tell, mastering syntax-case
requires a mental model equivalent in complexity to the macro expander's
implementation. As a result, Dan, Oleg, and I refuse to use syntax-case.
>> >
>> > The other Scheme macro system, syntax-rules, is strictly less powerful
than syntax-case, and can in fact be implemented in syntax-case. However,
the mental model required to use syntax-rules is much simpler, as it is
essentially a term-rewriting system with hygiene. For vanilla forms such as
let, and, and or, syntax-rules works beautifully. For incredibly
complicated macros, such as the match pattern matcher used in Kent Dybvig's
compiler course at Indiana, the full power of syntax-case is probably
required. For almost all other macros, it seems like a system with just a
little more power than syntax-rules would be both sufficient and ideal. For
example, often a macro writer wishes to concatenate two symbols--currently
this requires using syntax-case, even if the rest of the macro is trivial.
>> >
>> > If a hygienic macro system that hits the sweet spot between
syntax-rules and syntax-caseis created, I hope it will be adopted by
Schemers and Clojurers alike. A few steps in this direction include the
Dylan macro system and Ryan Culpepper's syntax-parse. Also needed is a way
to learn how to write non-trivial hygienic macros that doesn't involve
earning a PhD in programming languages from Indiana or Northeastern.
>> >
>> > The Racket and Scheme inner circle say that hygienic macros are the
future, but I wonder whether a worse-is-better argument can be mounted for
CL and/or Clojure macros.
>> >
>> > Personally, I only write Racket macros sparingly, but would like to
develop my level of understanding of comfort.
>> >
>> > What are some good ways to smooth out the learning curve?
>> >
>> >
>> > Dan
>> >
>> >
>> >
>> > On Sat, Mar 22, 2014 at 12:42 AM, Matthias Felleisen <
matthias at ccs.neu.edu> wrote:
>> >
>> > Welcome.
>> >
>> > Why don't you take a look at Greg's macro write-up
>> >
>> > http://www.greghendershott.com/fear-of-macros/
>> >
>> > and see whether this helps you wrap your head around macros.
>> >
>> >
>> >
>> >
>> > On Mar 21, 2014, at 9:48 AM, Alejandro Zamora Fonseca <
terefv at ltu.sld.cu> wrote:
>> >
>> > > Hi!!
>> > > My name is
>> > > Alejandro, i'm a Cuban Computer Scientist, new to Lisp(having 1 year
using CL), and wishing change to Racket.
>> > > I see the list and I hope make me a better Lisp programmer with your
kindly help.
>> > >
>> > > I have Racket installed in my PC, I like the language and tools, but
yet I don't understand well its macros(are completely different for me than
CL macros) and continuations.
>> > >
>> > > Greetings for all.
>> > >
>> > > Alejandro
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > >
>> > > Este mensaje le ha llegado mediante el servicio de correo
electronico que ofrece Infomed para respaldar el cumplimiento de las
misiones del Sistema Nacional de Salud. La persona que envia este correo
asume el compromiso de usar el servicio a tales fines y cumplir con las
regulaciones establecidas
>> > >
>> > > Infomed: http://www.sld.cu/
>> > >
>> > > ____________________
>> > > Racket Users list:
>> > > http://lists.racket-lang.org/users
>> >
>> >
>> > ____________________
>> > Racket Users list:
>> > http://lists.racket-lang.org/users
>> >
>> >
>> >
>> > --
>> > Daniel Prager
>> > Agile/Lean Coaching, Software Development and Leadership
>> > Startup: www.youpatch.com
>> > Twitter: @agilejitsu
>> > Blog: agile-jitsu.blogspot.com
>> > ____________________
>> > Racket Users list:
>> > http://lists.racket-lang.org/users
>>
>
>
>
> --
> Daniel Prager
> Agile/Lean Coaching, Software Development and Leadership
> Startup: www.youpatch.com
> Twitter: @agilejitsu
> Blog: agile-jitsu.blogspot.com
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140322/f98578ba/attachment-0001.html>