[e-lang] Call patterns

Dean Tribble tribble at e-dean.com
Mon Jul 24 02:53:31 EDT 2006


I don't get it.

It combines via -- which I still don't have an internal model for -- with
verb mangling into something that looks like it complicates the semantics of
message dispatch.  Is that the case?  Is there a reason why that is not
always a bad idea? :)

On 7/23/06, Kevin Reid <kpreid at mac.com> wrote:
>
> On Jul 23, 2006, at 1:09, Mark S. Miller wrote:
> > Kevin Reid wrote:
> >> def a.b(c) := d expands to
> >>   via (__makeVerbFacet.curryCall(a, "match__b/1")) [c]
> >>
> >> The idea is that call patterns are a form of extensible pattern
> >> which is more suitable than quasi-patterns for objects which do
> >> not naturally have a (semi-) textual syntax.
> ...
> > Let's decide on a pragma.enable/1 switch name for enabling it, so
> > we can experiment with it before deciding to add it officially to
> > E. How about
> >      pragma.enable("call-pattern")
> > ?
>
> E-on-CL already uses this switch.
>
> > What's its BNF?
>
> call-patt ::= ( <noun-expr> | <paren-expr> ) ( "." <verb> ) <paren-
> params>
>
>
> The ANTLR grammar in E-on-CL:
>
> eqPatt:     ...
>             |   nounExpr ( parenParams           pocket["call-pattern"]
>                                                  {##=#
> ([FunCallPattern],##);}
>                          | "."! verb parenParams pocket["call-pattern"]
>                                                  {##=#
> ([CallPattern],##);}
>                          | optGuard              {##=#
> ([FinalPattern],##);}
>                          )
>             ...
>             |   parenExpr ( quasiString           {##=#
> ([QuasiPattern],##);}
>                           | parenParams           pocket["call-
> pattern"]
>                                                   {##=#
> ([FunCallPattern],##);}
>                           | "."! verb parenParams pocket["call-
> pattern"]
>                                                   {##=#
> ([CallPattern],##);}
>                           )
>             ...
>             ;
>
> parenParams is a parameter list like "(a, [b, c])". nounExpr is
> misnamed, and actually a noun, URI <scheme> or $@hole.
>
>
> The abstract syntax:
>
> CallPattern(@{recipient :EExpr},
>             @{verb :string},
>             @{args :List[Pattern]}*)
> FunCallPattern(@{recipient :EExpr},
>                @{args :List[Pattern]}*)
>
>
> The abstract syntax definition and expansion code in E-on-CL:
>
> (defemacro |CallPattern| (|Pattern|) ((|recipient| t |EExpr|)
>                                       (|verb| nil string)
>                                       (|args| t (e-list |Pattern|)))
>                                      (:rest-slot t)
>   (mn '|ViaPattern|
>     (mn '|CurryExpr|
>       (mn '|CallExpr|
>         |recipient|
>         (format nil "match__~A/~A" |verb| (length |args|))))
>     (apply #'mn '|ListPattern| |args|)))
>
> (defemacro |FunCallPattern| (|Pattern|) ((|recipient| t |EExpr|)
>                                          (|args| t (e-list |Pattern|)))
>                                         (:rest-slot t)
>   (apply #'mn '|CallPattern| |recipient| "run" |args|))
>
> --
> Kevin Reid                            <http://homepage.mac.com/kpreid/>
>
>
> _______________________________________________
> e-lang mailing list
> e-lang at mail.eros-os.org
> http://www.eros-os.org/mailman/listinfo/e-lang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eros-os.org/pipermail/e-lang/attachments/20060723/b9ee3695/attachment-0001.html 


More information about the e-lang mailing list