|
|
clipka <ano### [at] anonymousorg> wrote:
> Am 01.03.2015 um 09:27 schrieb Thomas de Groot:
> > On 1-3-2015 2:51, clipka wrote:
> >> I've just implemented a syntax extension that you might like: As of the
> >> newest development version, you'll now be able to assign multiple
> >> variables with a single #declare (or #local) statement, like so:
> >>
> >> #declare (A,B,C) = (X,Y,Z);
> >>
> >> Obviously, this now allows for a single macro to return multiple items,
> >> like this:
>
> Sorry, forgot some part of the code (I guess I was a bit tired):
>
> >>
> >> #macro WindowFrameAndCutout(Pos,H,W)
> >> #local Frame = union {...};
> >> #local Cutout = box {...};
> #local Area = H*W;
> >> (Frame,Cutout,Area)
> >> #end
> >>
> >> #declare (MyFrame,MyCutout) = WindowFrameAndCutout(...);
> #declare (MyFrame,MyCutout,MyArea) = ...
> >>
> >> How's that? :D
> >
> > Probably neat, but I confess I do not really understand the example and
> > what it does...
>
> Suppose you have a set of macros to generate architecture; in such a
> framework, for windows you'll want both the windows itself, as well as a
> shape to cut a matching hole into the wall. And for some reason you
> might also be interested in knowing the area of the window, though I
> confess I just put it in there just to demonstrate that you can return
> values of different types.
I like it. It looks like some Python feature was it an inspiration?
Post a reply to this message
|
|