[prev in list] [next in list] [prev in thread] [next in thread] 

List:       racket-users
Subject:    [plt-scheme] dumb script question
From:       mvanier () cs ! caltech ! edu (Michael Vanier)
Date:       2004-11-26 20:10:08
Message-ID: 20041126201008.8FD539BDA9 () orchestra ! cs ! caltech ! edu
[Download RAW message or body]

Seems to work fine.  Please add it!

Mike

> From: Eli Barzilay <eli at barzilay.org>
> Date: Wed, 24 Nov 2004 22:13:15 -0500
> 
> On Nov 24, Michael Vanier wrote:
> > 
> > Great stuff, but all I want is (current-program-name) :-( Consider
> > this a feature request.
> 
> That doesn't make sense since the `program' is one of several
> files...  A `(current-load-file)' would make more sense, and be
> similar to the `(current-load-relative-directory)', but that will also
> be a little bogus if you happen to load more than a single file.
> 
> I think that the best approach to this is exactly the same as
> `this-expression-source-directory'.  Something like this seems
> reasonable:
> 
>   (define-syntax (this-expression-file-name stx)
>     (syntax-case stx ()
>       [(_)
>        (let* ([f (syntax-source stx)]
>               [f (and f (string? f) (file-exists? f)
>                       (let-values ([(base file dir?) (split-path f)]) file))])
>          (datum->syntax-object (quote-syntax here) f stx))]))
> 
> so it might be a good idea to add it to "etc.ss" --?  (Please tell me
> if it makes sense and I'll add it.)
> 
> (The only problem now is that the syntax-source is "STDIN" for
> interactive input, but seems like in v299 it changed to 'stdin
> instead.)
> 
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                   http://www.barzilay.org/                 Maze is Life!
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic