Trouble using (current-filename)

2012-02-14 Thread Mark H Weaver
I put the following test module in my load path: (define-module (current-filename-fail) :export (my-filename)) (define my-filename (current-filename)) (define (force-a-warning-message) (identity 1 2 3)) And this is what I see with Guile 2.0.5: GNU Guile 2.0.5 Copyright (C) 1995-201

Re: Trouble using (current-filename)

2012-02-15 Thread Andy Wingo
Hi Mark :) On Tue 14 Feb 2012 19:57, Mark H Weaver writes: > scheme@(guile-user)> my-filename > $1 = #f I get this result regardless of whether or not the (identity 1 2 3) is there, at least with master; but perhaps that is to be expected, given what you say: > The same thing happens if I

Re: Trouble using (current-filename)

2012-02-16 Thread Ludovic Courtès
Andy Wingo skribis: > (define-syntax current-filename > (lambda (x) > "A macro that expands to the current filename: the filename that > the (current-filename) form appears in. Expands to #f if this > information is unavailable." > (false-if-exception >(pk 'canonica

Re: Trouble using (current-filename)

2012-02-16 Thread Andy Wingo
On Thu 16 Feb 2012 22:34, l...@gnu.org (Ludovic Courtès) writes: > Andy Wingo skribis: > >> (define-syntax current-filename >> (lambda (x) >> "A macro that expands to the current filename: the filename that >> the (current-filename) form appears in. Expands to #f if this >> infor

Re: Trouble using (current-filename)

2012-02-17 Thread Ludovic Courtès
Hi, Andy Wingo skribis: > On Thu 16 Feb 2012 22:34, l...@gnu.org (Ludovic Courtès) writes: > >> Andy Wingo skribis: >> >>> (define-syntax current-filename >>> (lambda (x) >>> "A macro that expands to the current filename: the filename that >>> the (current-filename) form appears i

Re: Trouble using (current-filename)

2012-02-18 Thread Andy Wingo
On Fri 17 Feb 2012 23:49, l...@gnu.org (Ludovic Courtès) writes: > Would it work to let the user call it themself if needed, like: > > (add-to-load-path (dirname (canonicalize-path (current-filename I would rather have current-filename do a (or (false-if-exception (canonicalize-path p))

Re: Trouble using (current-filename)

2012-02-19 Thread Ludovic Courtès
Hi, Andy Wingo skribis: > On Fri 17 Feb 2012 23:49, l...@gnu.org (Ludovic Courtès) writes: > >> Would it work to let the user call it themself if needed, like: >> >> (add-to-load-path (dirname (canonicalize-path (current-filename > > I would rather have current-filename do a > > (or (fal

Re: Trouble using (current-filename)

2012-02-19 Thread Andy Wingo
Hi, On Sun 19 Feb 2012 15:10, l...@gnu.org (Ludovic Courtès) writes: > Andy Wingo skribis: > >> On Fri 17 Feb 2012 23:49, l...@gnu.org (Ludovic Courtès) writes: >> >>> Would it work to let the user call it themself if needed, like: >>> >>> (add-to-load-path (dirname (canonicalize-path (current

Re: Trouble using (current-filename)

2012-02-19 Thread Ludovic Courtès
Hello! Andy Wingo skribis: > On Sun 19 Feb 2012 15:10, l...@gnu.org (Ludovic Courtès) writes: > >> Andy Wingo skribis: >> >>> On Fri 17 Feb 2012 23:49, l...@gnu.org (Ludovic Courtès) writes: >>> Would it work to let the user call it themself if needed, like: (add-to-load-path (

Re: Trouble using (current-filename)

2012-02-19 Thread Andy Wingo
On Sun 19 Feb 2012 22:02, l...@gnu.org (Ludovic Courtès) writes: >> See Neil's use case here: >> >> http://thread.gmane.org/gmane.lisp.guile.devel/13440/focus=13621 >> >> Can we do something that makes sense for both cases? > > Well, (add-to-load-path (dirname (canonicalize-path (current-filenam

Re: Trouble using (current-filename)

2012-02-19 Thread Noah Lavine
What about having two bits of syntax, current-filename and current-file-path? Or better yet, current-filename and current-file-directory, with the guarantee that (string-append (current-file-directory) path-separator (current-filename)) points to the file when it was compiled? It is more intuitive

Re: Trouble using (current-filename)

2012-02-20 Thread Ludovic Courtès
Hi, Noah Lavine skribis: > What about having two bits of syntax, current-filename and > current-file-path? Or better yet, current-filename and > current-file-directory, with the guarantee that (string-append > (current-file-directory) path-separator (current-filename)) points to > the file when

Re: Trouble using (current-filename)

2012-02-21 Thread Mark H Weaver
Andy Wingo writes: > Not sure what the right thing is here. It seems to depend on whether > the file is relative to the path or the current working directory. You > have any thoughts here? Why don't the source properties include the full pathname? If there are places where it's desirable to st

Re: Trouble using (current-filename)

2012-02-21 Thread Neil Jerram
Sorry for chipping in late to this discussion. l...@gnu.org (Ludovic Courtès) writes: > I think it’s often undesirable. > > Suppose you want to use ‘current-filename’ in an ‘assert’ macro, for > instance: what you want is a hint, not an absolute path, since that path > is likely to be invalid at

Re: Trouble using (current-filename)

2012-02-21 Thread Ludovic Courtès
Hi Neil! Neil Jerram skribis: > Perhaps after all the right thing, for my use case, is something based > on (car (command-line)) and (getcwd). I currently have this > 'compatibility definition' for Guile 1.8.x: > > (define (current-filename) > (let* ((script (car (command-line))) >

Re: Trouble using (current-filename)

2012-02-21 Thread Neil Jerram
l...@gnu.org (Ludovic Courtès) writes: > Hi Neil! > > Neil Jerram skribis: > >> Perhaps after all the right thing, for my use case, is something based >> on (car (command-line)) and (getcwd). I currently have this >> 'compatibility definition' for Guile 1.8.x: >> >> (define (current-filena

Re: Trouble using (current-filename)

2012-03-14 Thread Noah Lavine
Hello, What ever happened to this issue? Is it considered resolved now, or is there more to do? And if it's not resolved, what do people think of having more than one piece of syntax? Noah On Tue, Feb 21, 2012 at 4:00 PM, Neil Jerram wrote: > l...@gnu.org (Ludovic Courtès) writes: > >> Hi Neil

Re: Trouble using (current-filename)

2012-03-15 Thread Neil Jerram
Noah Lavine writes: > Hello, > > What ever happened to this issue? Is it considered resolved now, or is > there more to do? For my use case it's resolved, in the sense that I really needed a runtime directory that may not be the same as the source compilation location; and hence 'current-filenam

Re: Trouble using (current-filename)

2012-03-15 Thread Ludovic Courtès
Hello, So if my recollection is correct, the ‘canonicalize-path’ call in ‘current-filename’, which was controversial, can now be removed. Andy: WDYT? Ludo’.

Re: Trouble using (current-filename)

2012-03-15 Thread Andy Wingo
On Thu 15 Mar 2012 17:41, l...@gnu.org (Ludovic Courtès) writes: > So if my recollection is correct, the ‘canonicalize-path’ call in > ‘current-filename’, which was controversial, can now be removed. > > Andy: WDYT? Well it's not what I wanted, but I don't care much. Please fix the documentation

Re: Trouble using (current-filename)

2012-03-21 Thread Ludovic Courtès
Hi, Andy Wingo skribis: > On Thu 15 Mar 2012 17:41, l...@gnu.org (Ludovic Courtès) writes: > >> So if my recollection is correct, the ‘canonicalize-path’ call in >> ‘current-filename’, which was controversial, can now be removed. >> >> Andy: WDYT? > > Well it's not what I wanted, but I don't car