Hey all,

There are some tricks I'd like to do with Sass mixins that require
lexically scoped redefinition of variables.  The machinery for this is
pretty much already in place with the stacked environments that
lexically scope variable definitions. The problem is that try_set_var
always tries parent.try_set_var, meaning that any definition of an
already-defined variable always directly affects the scope in which
the variable was originally defined, whereas I'd like it to "mask" the
outer definition with a temporary scoped definition.

Doing this would require adding some syntax to mark when you want a
scoped redefinition as opposed to a global redefinition (personally
I'd prefer = to mean scoped redefinition and something like != for
global redefinition, but that's backwards incompatible). Is there
something I'm missing here, or a reason why this hasn't already been
done? Would a patch for this be interesting to anyone else?

(My use case is for a percentage-based elastic grid system, where
nested columns need to know the width in columns of their parent
element in order to generate the correct percentage width. Currently
the context width has to be manually passed in as a mixin arg, but
with scoped redefinition of variables it could be neatly handled
automatically by the mixins themselves.)

Oh, and while I'm making a pony wishlist anyway: is there a reason why
functions in Sass::Script::Functions don't have access (afaict) to the
current environment object? Or do they, and I'm just not seeing how?

Sass is super-awesome - many thanks to the devs.

Carl

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to