chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] A Scheme based make - soliciting you comments


From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] A Scheme based make - soliciting you comments
Date: 13 Jun 2013 14:50:09 +0200

sorry, I'Ve been lying.

Accidental :-/

On Jun 12 2013, Jörg F. Wittenberger wrote:

I know the feeling! And I have started a project in that direction, as
well. It's been on a detour due to some yaks on the road for a bit now
but I have hopes to find time to hack on the actual thing again
soon. Also I have some yak fur coats to spare if anyone is interested.

Might be interesting!

It the source anywhere?

I've looked at it and have a question: It looks like you chose to build
a separate language (or preprocessor) on top of Scheme. Is that
assessment correct?
...
Can you explain why you chose to do so?

There are exactly two primitives, which I did not (yet) implement
in pure Scheme.  The reason: I'd rather love to discuss the pros and cons
before.  For the time being I wanted those to be a straight error if
fed to a Scheme interpreter - makes it much easier to spot them once
it became clear how they should look alike.

Those are:

1.) The way to get build parameters from the invocation.
   Meanwhile there is little need left to keep this as a special syntax.
   (Except maybe for just the reason that they are so easy spotted.)

Here I forgot the reason, why I decided that I don't know how I could
write this simply in Scheme:

You want to be able to fine-control how to overwrite these build parameters
without having to write them into a file, but also allow this as one
possible alternative.

BTW: just feed another file after the standard build description will
not work easily.  While we could overwrite definitions there, it's too
late since prior values where defined with the defaults effective instead.
The only way I'd see would be to feed in three files: the defaults
followed by the overwrites then the build rules.  Just too impractical
and error prone.

Best idea so far: the *first* definition wins.
Example:

#(param: PREFIX "/usr/local")

==> look for PREFIX in the environment, use this if found, else "/usr/local"

Example2:
use with two files; put the local config before the standard

file one: config.mk.scm
#(param: PREFIX "/home/me/build/test" )

==> look for PREFIX, use "/home/me/build/test" if not set

file two: standard.mk.scm

#(param: PREFIX "/usr/local") ;; as before

==> second definition for PREFIX, find it already defined ignore this one.



In a related note: I do actually:

* contemplate to allow a choice of languages instead of Scheme for
 the actions and all

* once that's done, implement a *restricted* version of Scheme, which
 would *not* allow set! and other side effects and accept no overwrites
 for definitions

 + show that this is still easy enough to use for the purpose
+ demo that it results in much more readable and clearer build descriptions
 + assuming the last two "+" didn't fail: recommend this one only


   Currently written as
   #(param: <string-or-symbol-as-identifier> <default>)
   where <default> is optional.  And I used additional vector elements
   for a short docstring tentatively to be extracted by some "help"
   target.

   Could be written like:

    (define internal-name (make-parameter "ENVSTRING" default))

2.) Conditional Code Inclusion

   Basically an "alternative" to cond-expand, but:

   * must take into account those parameters from above.
   * should allow rather arbitrary Scheme expressions as predicates,
     not just feature identifiers as cond-expand does.
     Rationale: be practical.  cond-expand is good for Scheme, but
     is it good for a make?

   I choose to not use s-expressions for this construct and I doubt
   that doing so would be a good idea.  Those conditional are typically
   introduced late in the project.  E.g., when adding a port to another
   platform.  Often they are temporary until a better solution is found.
   You don't want to re-indent all your code in that case.  It ends up
   *all* in the diff.

BTW: This is also hard in plain Scheme: there can be `define`s in
alternate conditional sections.  Either as declarations of the same
parameter with a different default or as normal `(define var val)`

Those you want to be visible at top level; don't you?

(when <test> (define PREFIX "/home/me/testdir") )    ???

Wrong scope!


Best Regards


/Jerry

...........




reply via email to

[Prev in Thread] Current Thread [Next in Thread]