[bitc-dev] Syntax Poll: Scoping Syntax

Jonathan S. Shapiro shap at eros-os.com
Thu Mar 5 15:20:42 EST 2009


On Thu, Mar 5, 2009 at 2:12 PM, Rick R <rick.richardson at gmail.com> wrote:
> Sorry I was confused about the issue above. I was reading {} in the block
> sense, not the EBNF sense.
>
>
> let { BINDING DELIMITER } *
> in
>   EXPR
>
>
> where DELIMITER is ; or "\n"
> effectively,  "in" would signify the end of the let block. and the variables
> defined in the let block would be scoped only to the let block and EXPR

Once again, this isn't the problem. The "in" signals the end of the
binding patterns, not the let block. The question at hand is: what
signals the end of the let *body*?

I'm re-learning lessons in the challenges of writing clear email about
this sort of thing. ;-)

> and EXPR has something to signify the beginning and end of its scope.
> In code it would look like (modifying Zorg's example)
>
>    let light_pos = [|-20.0; 20.0; 10.0; 1.0|];
>         angle       = 42.0;
>         light_diffuse = [|1.0; 1.0; 0.9; 1.0|];
>         light_specular = [|1.0; 1.0; 0.9; 1.0|];
>         light_ambient = [|0.15; 0.15; 0.15; 1.0|];
>         light_normal = (normalize light_pos) * angle
>    in
>    {
>        glLightfv gl_light0 gl_position light_pos;
>        glLightfv gl_light0 gl_diffuse light_diffuse;
>        glLightfv gl_light0 gl_specular light_specular;
>        glLightfv gl_light0 gl_ambient light_ambient;
>    }

Okay. I agree that this works syntactically. I note that if the "{" is
mandatory then the "in" is syntactically redundant.

Just so I am clear, are you specifically advocating curly braces, or
would you find in/end acceptable as an alternative?


shap


More information about the bitc-dev mailing list