Hola! So, the arguments passed to macros are by reference and not by value? I could have known of course, they are simple expansions, but I’d like to be sure. IfI assign to a variable inside a vardef macro and that variable is not ’save’d I’m changing the original?
G > On 16 Mar 2020, at 09:31, Taco Hoekwater <t...@elvenkind.com> wrote: > > > >> On 15 Mar 2020, at 11:22, Gerben Wierda <gerben.wie...@rna.nl> wrote: >> >> I would like a vardef macro to return the pair of a picture and a bounding >> box. I don't want to use the setbound operator, because as soon as I do >> that, I cannot access the components of the picture anymore with pathpart. >> >> I found metapost vardef returning multiple values on StackExchange but that >> is about returning multiple values of the same numeric type. Is it possible >> to have vardef return a set of (picture, path) or (picture, picture) in some >> way? If not, I need to make two vardef macros for each result type. > > Sure, using that same endgroup,begingroup trick. But since there is no > multi-assignment in metapost that doesn’t you help much. > Either two separate vardefs or passing the to-be-assigned variable(s) as an > extra argument(s) are generally more practical. > > Best wishes, > Taco > > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________