On Fri, Feb 9, 2018 at 10:05 AM, Steven Watanabe via Boost-build <boost-build@lists.boost.org> wrote:
AMDG

On 02/09/2018 06:25 AM, Rene Rivera via Boost-build wrote:
> On Fri, Feb 9, 2018 at 7:07 AM, Fabien Chêne via Boost-build <
> boost-build@lists.boost.org> wrote:
>
>>
>> I was wondering if it were possible to extend the bjam grammar so that:
>>
>> rule lib ( name : sources * : requirements * )
>>
>> can be called either (possibly using named arguments coming from the
>> rule definition):
>> lib foo : a.C b.C : requirements <define>XXX ;
>> lib foo : sources a.C b.C : requirements <define>XXX ;
>> lib foo : requirements <define>XXX : sources a.C b.C ;
>> lib sources a.C b.C : name foo : requirements <define>XXX ;
>>
>> What do you think ?
>>
>

  I already implemented this in develop.  It is implemented
as a library extension rather than a language extension,
so rules must explicitly make use of it:

param.handle-named-params sources requirements
  default-build usage-requirements ;

I applied it to all main-target rules.

> IIRC we discussed this some long time ago.. You example usage is not "easy"
> to accomplish in a backward compatible way.

  It's true that it isn't perfectly backwards compatible,
but I didn't find any conflicts in Boost.  Also, applying
it on a per-rule basis is much safer than baking it into
the language.

That's a reasonable solution too. 

> The best alternative that I
> remember was having the argument names be a special format. For example:
>
> lib foo : a.C b.C :requirements <define>XXX ;
> lib foo :sources a.C b.C :requirements <define>XXX ;
> lib foo :requirements <define>XXX :sources a.C b.C ;
> lib :sources a.C b.C :name foo :requirements <define>XXX ;
>
> That is having named arguments be ":<arg-name> arg .." (colon prefixed).
> Which would allow to distinguish them and the list value from all the other
> arguments. How does that sound to you?
>

That syntax conflicts with changing the lexer.

Good point.. Although it would be nice to have some syntax that would apply at the language level. As it would be useful in general coding itself.

--
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net