Follow-up Comment #1, bug #51286 (project make):

If the value you are trying to assign to a variable is guaranteed to contain
no spaces, you could use
  $(foreach var,<val>,<...>)
but that is a bit of a hack of course.

More complete lexical scoping was proposed on the mailing list
(https://lists.gnu.org/archive/html/bug-make/2019-12/msg00017.html) in the
form of let expressions
  $(let <var>,<val>,<...>)
but Paul Smith expressed his concern that let expressions may be to foreign to
the audience of make and that they do not fit the overall design of make
nicely.

I have attached the working prototype for implementing let expressions, which
lack documentation. Essentially, each word of <val> is assigned to each
variable name in <var>, where the last variable name gets all remaining words
in <val>. If there are more words in <var> than in <val>, the corresponding
variables will be empty.

(file #48701)
    _______________________________________________________

Additional Item Attachment:

File name: let-function.patch             Size:2 KB
    <https://savannah.gnu.org/file/let-function.patch?file_id=48701>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?51286>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply via email to