List Info

Thread: Overuse of jam features




Overuse of jam features
country flaguser name
Russian Federation
2007-03-19 16:26:47
Looking at python.jam, I see this:

	includes ?= [ path-to-native
$(:E=python$(version):R=$(:E=include:R=$(prefix))) ] ;

and I have not the slightest clue what this is supposed to
do. I suspect it
concatenates, $(prefix), "include" and
"python$(version), but the meaning of $(:E) syntax
is not obvious for me, and use of nested expansions does not
seem clear.

Would it be better to stay away from arcane features of
bjam, rather than 
use them like that?

- Volodya
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Overuse of jam features
country flaguser name
United States
2007-03-19 17:25:11
on Mon Mar 19 2007, Vladimir Prus <ghost-AT-cs.msu.su>
wrote:

> Looking at python.jam, I see this:
>
> 	includes ?= [ path-to-native
$(:E=python$(version):R=$(:E=include:R=$(prefix))) ] ;
>
> and I have not the slightest clue what this is supposed
to do. I suspect it
> concatenates, $(prefix), "include" and
"python$(version), 

Yes, bingo!  Maybe it was clearer than you thought?

> but the meaning of $(:E) syntax is not obvious for me,

   $(:E=xxx...) 

is the same as

   local tmp = xxx ;

   $(tmp...)

> and use of nested expansions does not seem clear.

It seemed clearer to me than writing it in multiple steps.

> Would it be better to stay away from arcane features of
bjam, rather
> than use them like that?

Perhaps.  However, I understand what they do, and I know
they will
work with what the user writes in user-config.jam whether he
uses
native path syntax or just sticks with forward slashes.

I've never been able to get comfortable with the use of
"normalized"
paths as in path.jam; I'm always afraid of losing track of
whether I'm
working with native or "normalized" syntax, and I
end up with a
dilemma: if I write functions that only accept
"normalized" paths, I
can't expose them to end-users without explaining how to
form such
paths on windows.  If I write functions that accept native
paths and
translate them into normalized paths, I can't call them from
other
internal functions that use normalized paths without first
translating
the paths back to native.  So I've never found a way to use
path.jam
that's both consistent and forgiving.

In general I think $(X:Y=...) is an arcane syntax, but once
you learn
what it does, it's not too hard to read.  The same applies
to
$(:E=...), and it's actually a pretty natural way to view
what happens
with bjam variable expansion.  After all, wouldn't you
expect

    local x ;
    $($(x):E=foo)

to yield "foo"?  Since x is empty, it seems
obvious to me that

    $(:E=foo)

is equivalent.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )