Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Bruce Korb writes: > On 01/04/12 13:52, Ian Price wrote: >>> So my main question is: >>> >>>Which is the higher priority, language purity or ease of use? >> That is a loaded question, as it presupposes ease of use is always the >> same thing as impurity e.g. ... > > Absolutely not. Making de

Questions about the compiler et al

2012-01-04 Thread Mark H Weaver
Hello all, While writing the more complex variant of the compiler implementation of `the-environment' and `local-eval', I learned a great deal about the compiler, and accumulated the following list of questions along the way. If someone with sufficient knowledge could answer at least some of thes

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
I wrote: > (define-syntax define > (lambda (x) > (with-syntax ((orig-define #'(@ (guile) define))) > (syntax-case x () > ((_ (proc arg ...) e0 e1 ...) >#'(orig-define proc (lambda (arg ...) e0 e1 ...))) > ((_ v e) >(identifier? #'v) >

Re: Minimal Guile

2012-01-04 Thread Mark H Weaver
Mike Gran writes: > If there were a go archive, I could finally make a port to > MS-DOS because I could ignore the 8.3 filesystem limitation.  ;-) A much simpler solution would be to modify the logic near the top of `try-module-autoload' in boot-9.scm, which translates a module name to a pathname

Re: Guile: What's wrong with this?

2012-01-04 Thread Ludovic Courtès
Hi, Bruce Korb skribis: > On 01/04/12 13:17, Ludovic Courtès wrote: >> If the users files are evaluated rather than compiled/loaded, this is >> not a problem: > > I do *all* guile processing via the ag_scm_c_eval_string_from_file_line > function. [...] >> Could you check whether this is the ca

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Bruce Korb writes: > You have to go to some extra trouble to be certain that a string > value that you have assigned to an SCM is not read only. If you're going to mutate a string, you'd better be safe and make a copy before mutating it, unless you know very clearly where it came from. Otherwise,

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 15:19, Mark H Weaver wrote: Bruce Korb writes: ERROR: In procedure string-upcase: ERROR: string is read-only: "" Scheme evaluation error. AutoGen ABEND-ing in template confmacs.tlib on line 209 Failing Guile command: = = = = = (set! tmp-text (get "act-text")) (se

Re: Guile: What's wrong with this?

2012-01-04 Thread Mike Gran
> From: Bruce Korb >>>     Which is the higher priority, language purity or ease of use? >> That is a loaded question, as it presupposes ease of use is always the >> same thing as impurity e.g. ... > Absolutely not.  Making decisions is always about trade-offs, > otherwise it is not really a d

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Bruce Korb writes: >> ERROR: In procedure string-upcase: >> ERROR: string is read-only: "" >> Scheme evaluation error. AutoGen ABEND-ing in template >> confmacs.tlib on line 209 >> Failing Guile command: = = = = = >> >> (set! tmp-text (get "act-text")) >>(set! TMP-text (string-upca

Re: Guile: What's wrong with this?

2012-01-04 Thread Ludovic Courtès
Hello, Bruce Korb skribis: > So my main question is: > > Which is the higher priority, language purity or ease of use? FWIW I think “language purity” is one way to achieve “ease of use” (FSVO “language purity” at least.) Ludo’.

Re: Guile: What's wrong with this?

2012-01-04 Thread Ludovic Courtès
Hi! Mark H Weaver skribis: > For example, look at what Guile 1.8 does: > > guile> (let loop ((i 0)) >(define y "hello") >(display y) >(newline) >(string-set! y i #\a) >(loop (1+ i))) > hello > aello > aallo > aaalo > o >

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
Hi Ludo, On 01/04/12 13:17, Ludovic Courtès wrote: If the users files are evaluated rather than compiled/loaded, this is not a problem: I do *all* guile processing via the ag_scm_c_eval_string_from_file_line function. I suck up a string from my input file, determine that it needs guile proces

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 13:52, Ian Price wrote: So my main question is: Which is the higher priority, language purity or ease of use? That is a loaded question, as it presupposes ease of use is always the same thing as impurity e.g. ... Absolutely not. Making decisions is always about trade-offs, oth

Re: Guile: What's wrong with this?

2012-01-04 Thread Ian Price
Bruce Korb writes: > On 01/04/12 04:19, Ian Price wrote: >> ... As for mutable strings, I consider them >> a mistake to begin with,... > > Let's step back and consider the whole point of Guile in the first place. This was not intended as an answer to this question, nor to be representative of th

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 12:56, Andy Wingo wrote: On Wed 04 Jan 2012 15:08, Bruce Korb writes: On 01/04/12 11:43, Andy Wingo wrote: The correct behavior is the status quo. We are considering adding a hack to produce different behavior for compatibility purposes. We don't have to worry about correctness

Re: Guile: What's wrong with this?

2012-01-04 Thread Ludovic Courtès
Hi Bruce, Bruce Korb skribis: > On 01/03/12 15:33, Ludovic Courtès wrote: >> Could you point me to the affected code? What would you think of using >> string-copy as I suggested? The disadvantage is that you need to modify >> your code, but hopefully that can be automated with a sed script or

Re: Guile: What's wrong with this?

2012-01-04 Thread Ludovic Courtès
Hi! Mike Gran skribis: >>   In many systems it is desirable for constants (i.e. the values of literal >>   expressions) to reside in read-only-memory.  To express this, it is >>   convenient to imagine that every object that denotes locations is >>   associated with a flag telling whether that o

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 15:08, Bruce Korb writes: > On 01/04/12 11:43, Andy Wingo wrote: >> The correct behavior is the status quo. We are considering adding a >> hack to produce different behavior for compatibility purposes. We don't >> have to worry about correctness in that case, only compatibili

Re: Chunked Encoding

2012-01-04 Thread Andy Wingo
On Thu 29 Sep 2011 16:09, Ian Price writes: > If you've used the (web ...) modules, you may have noticed that guile > does not currently support chunked-encoding. This is expected in a > HTTP/1.1 world, so I wrote an implementation to cover my immediate > need, but I'm not particularly convinced

Re: peval update

2012-01-04 Thread Andy Wingo
Hi Ludo :) On Sat 01 Oct 2011 16:45, l...@gnu.org (Ludovic Courtès) writes: > (As you can see I’m lagging behind and notice guile-commits before > guile-devel. :-)) As you can see I'm lagging behind 2012 and am answering mails from 2011 :) > It also removes the main reason for not having peval

Re: Minimal Guile

2012-01-04 Thread Andreas Rottmann
Andy Wingo writes: > On Tue 03 Jan 2012 22:44, Mark H Weaver writes: > >> If this single file is to be built only during the package build >> process, and never modified after that, then it should be super-easy to >> invent your own little homebrew format. > > Indeed. It would be nice to use EL

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Bruce Korb writes: > Who knows where I learned the idiom. I learned the minimal amount of > Guile needed for my purposes a dozen years ago. My actual problem > stems from this: > >> Backtrace: >> In ice-9/boot-9.scm: >> 170: 3 [catch #t # ...] >> In unknown file: >>?: 2 [catch-closure] >>

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Bruce Korb writes: > On 01/04/12 11:43, Andy Wingo wrote: >> The correct behavior is the status quo. We are considering adding a >> hack to produce different behavior for compatibility purposes. We don't >> have to worry about correctness in that case, only compatibility. IMO >> anyway :) > >

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 11:43, Andy Wingo wrote: The correct behavior is the status quo. We are considering adding a hack to produce different behavior for compatibility purposes. We don't have to worry about correctness in that case, only compatibility. IMO anyway :) It would be a nice added benefit if

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 14:29, Mark H Weaver writes: > Although this is a closer emulation of the previous (broken) behavior, > IMHO this would be less desirable than simply doing (string-copy "foo") > on every evaluation of "foo", which seems to be what Bruce (and probably > others) expected "foo" to

Re: guild hall, R7RS, and the name

2012-01-04 Thread Andy Wingo
Hi John! On Wed 28 Sep 2011 19:51, John Gabriele writes: > There's been some discussion recently at the scheme-reports ML about a > distributed module repository. Would a guildhall be necessary if there > were a central R7RS module repository (duplication of effort)? Good question. It is hypot

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 10:26, Ian Price wrote: Just because an obscure-to-those-not-living-and-breathing-Scheme-daily document said it was okay doesn't make it okay to those whacked by it. There's an old saying, "Ignorance of the law is no excuse". If I wrote C code that doesn't conform to the C standard

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Andy Wingo writes: >> David Kastrup writes: >>> What for? It would mean that a literal would not be eq? to itself, a >>> nightmare for memoization purposes. >> >> I agree that it should not be the default behavior, but I don't see the >> harm in allowing users to compile their own code this way

Re: Minimal Guile

2012-01-04 Thread Andy Wingo
On Tue 03 Jan 2012 22:44, Mark H Weaver writes: > If this single file is to be built only during the package build > process, and never modified after that, then it should be super-easy to > invent your own little homebrew format. Indeed. It would be nice to use ELF, though. I'd like to change

Re: Minimal Guile

2012-01-04 Thread Mike Gran
>> There are some theoretical corner cases where it could be useful. >> Don't know if these would ever occur in practice. >> - Systems that don't use a Unix-like filesystem heirarchy > > I also don't see how Unix-like filesystem semantics affect this > question.   If there were a go archive, I

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Ian Price writes: > — Scheme Procedure: substring-fill! str start end fill > — C Function: scm_substring_fill_x (str, start, end, fill) > > Change every character in str between start and end to fill. > > (define y "abcdefg") > (substring-fill! y 1 3 #\r) >

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 13:31, Mark H Weaver writes: > Andy Wingo writes: >> We could add a compiler option to turn string literals into (string-copy >> FOO). Perhaps that's the thing to do. > > I think this would be fine, as long as the default is _not_ to copy > string literals. This would help B

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Andy Wingo writes: > We could add a compiler option to turn string literals into (string-copy > FOO). Perhaps that's the thing to do. I think this would be fine, as long as the default is _not_ to copy string literals. This would help Bruce a great deal with very little effort on our part, with

Re: Guile: What's wrong with this?

2012-01-04 Thread Ian Price
Bruce Korb writes: > On 01/04/12 08:47, Andy Wingo wrote: >> I was going to propose a workaround with an option to change >> vm-i-loader.c:43 and vm-i-loader.c:115 to use a >> scm_i_mutable_string_literals_p instead of 1, but that really seems like >> the path to perdition: previously compiled mo

Re: A Plan for Hacking

2012-01-04 Thread Andy Wingo
Hi Noah, I never contributed to this thread, but I've had it marked for months now, so FWIW... On Sat 24 Sep 2011 19:58, Noah Lavine writes: > So this is my proposal for the next several months: I work on a static > analyzer for Guile, hoping to expand it to other languages as well. This sound

Re: Names for PEG Functions

2012-01-04 Thread Andy Wingo
Hi Noah, On Mon 03 Oct 2011 20:21, Noah Lavine writes: > I hate to make more work for people, but I think the PEG module is > almost ready for merging, and could probably be merged if we resolved > this names issue. Any other thoughts? Have you updated the wip-peg branch? I don't remember who

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 12:49, David Kastrup writes: > (define (zap) "hello") > (eq? (zap) (zap)) > > This expression may not choose to be true or false. Indeed, good point. Andy -- http://wingolog.org/

Re: Creating guild bundles [bug/feature request]

2012-01-04 Thread Andy Wingo
Hi Ian, Thanks for testing the guildhall! Again, terribly sorry for the delay. On Sun 04 Sep 2011 08:24, Ian Price writes: > $ guild create-bundle > Creating pfds_0.zip > $ unzip -l pfds_0.zip > Archive: pfds_0.zip > Length DateTimeName > − −− − >

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Andy Wingo writes: > On Wed 04 Jan 2012 12:14, David Kastrup writes: > >> Andy Wingo writes: >> >>> We could add a compiler option to turn string literals into >>> (string-copy FOO). Perhaps that's the thing to do. >> >> What for? It would mean that a literal would not be eq? to itself, a >>

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Bruce Korb writes: > On 01/04/12 08:47, Andy Wingo wrote: >> I was going to propose a workaround with an option to change >> vm-i-loader.c:43 and vm-i-loader.c:115 to use a >> scm_i_mutable_string_literals_p instead of 1, but that really seems like >> the path to perdition: previously compiled mo

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Bruce Korb writes: > On 01/04/12 04:19, Ian Price wrote: >> ... As for mutable strings, I consider them >> a mistake to begin with,... > > Let's step back and consider the whole point of Guile in the first place. > > My understanding is that one primary purpose is to be a facilitation > language

Re: bytevector -- was: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
Hi, On 01/03/12 19:12, Noah Lavine wrote: Then it turned out that the string functions would now clear the high order bit on strings, so they are no longer byte arrays and there is no replacement but to roll my own. I stopped supporting byte arrays. A noticable nuisance. This is just a side

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 12:14, David Kastrup writes: > Andy Wingo writes: > >> We could add a compiler option to turn string literals into >> (string-copy FOO). Perhaps that's the thing to do. > > What for? It would mean that a literal would not be eq? to itself, a > nightmare for memoization purpo

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 08:47, Andy Wingo wrote: I was going to propose a workaround with an option to change vm-i-loader.c:43 and vm-i-loader.c:115 to use a scm_i_mutable_string_literals_p instead of 1, but that really seems like the path to perdition: previously compiled modules would start creating mutabl

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 12:16, Bruce Korb writes: >> We could add a compiler option to turn string literals into (string-copy >> FOO). Perhaps that's the thing to do. > > No, because your clients have no control over how Guile gets built. > We _do_ have control over startup code, however: I meant th

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Mike Gran writes: >> From: Mark H Weaver >> No, `define' does not copy an object, it merely makes a new reference to >> an existing object.  This is also true in C for that matter, so this is >> behavior is quite mainstream.  For example, the following program dies >> with SIGSEGV on most modern

Re: Guile: What's wrong with this?

2012-01-04 Thread Bruce Korb
On 01/04/12 04:19, Ian Price wrote: ... As for mutable strings, I consider them a mistake to begin with,... Let's step back and consider the whole point of Guile in the first place. My understanding is that one primary purpose is to be a facilitation language so that application developers ha

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Andy Wingo writes: > We could add a compiler option to turn string literals into > (string-copy FOO). Perhaps that's the thing to do. What for? It would mean that a literal would not be eq? to itself, a nightmare for memoization purposes. And for what? For making code with explicitly undefin

Re: Guile: What's wrong with this?

2012-01-04 Thread Andy Wingo
On Wed 04 Jan 2012 09:29, Mike Gran writes: >   char y[6] = "hello"; >   > C provides a way to create and initialize a mutable string. This one is more like (define y (string #\h #\e #\l #\l #\o)) just like (define y (list #\h #\e #\l #\l #\o)) (define y (vector #\h #\e #\l #\l #\o)) e

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Mike Gran writes: > If you follow that logic, then Guile is left without any shorthand > to create and initialize a mutable string other than >   > (define y (substring "hello" 0)) > or > (define y (string-copy "hello")) Sure. Guile does not have shorthands for _mutable_ literals for lists or

Re: Guile: What's wrong with this?

2012-01-04 Thread Mike Gran
> From: Mark H Weaver > No, `define' does not copy an object, it merely makes a new reference to > an existing object.  This is also true in C for that matter, so this is > behavior is quite mainstream.  For example, the following program dies > with SIGSEGV on most modern systems, including GNU/L

Re: Continuation sets and order-independency

2012-01-04 Thread David Kastrup
Noah Lavine writes: >> On Wed, Jan 4, 2012 at 8:16 AM, David Kastrup wrote: >>> >>> Hi, >>> >>> I was just wondering about the ability for using multiple continuations >>> in contexts that don't guarantee an order of execution.  Functions like >>> map, list and other structure builders. >>> >>>

Re: Continuation sets and order-independency

2012-01-04 Thread Noah Lavine
Let me see if I understand what you mean. I think you're talking about an expression like this: (cons (call/cc store-this-continuation) (call/cc store-this-continuation)) and you want a way to distinguish the first and the second call/cc, by guaranteeing the order they are hit. This will let yo

Continuation sets and order-independency

2012-01-04 Thread David Kastrup
Hi, I was just wondering about the ability for using multiple continuations in contexts that don't guarantee an order of execution. Functions like map, list and other structure builders. If one uses those for building a structure, and some paths of execution hit a call-with-current-continuation

Re: Guile: What's wrong with this?

2012-01-04 Thread Ian Price
Bruce Korb writes: > You have changed the interface without deprecation or any other multi-year > process. > Please change it back. Please fix the problem by adding (define-strict y > "hello") > to have this new semantic. Thank you. Fixing it with define-strict is ridiculous, as y is still m

Re: Guile: What's wrong with this?

2012-01-04 Thread Mark H Weaver
Bruce Korb writes: > 2. it is completely, utterly wrong to mutilate the > Guile library into such a contortion that it > interprets this: > (define y "hello") > to be a request to create an immutable string anyway. > It very, very plainly says, "make 'y' and fill it with >

Re: Guile: What's wrong with this?

2012-01-04 Thread David Kastrup
Mike Gran writes: >>   In many systems it is desirable for constants (i.e. the values of literal >>   expressions) to reside in read-only-memory.  To express this, it is >>   convenient to imagine that every object that denotes locations is >>   associated with a flag telling whether that object

Re: Guile: What's wrong with this?

2012-01-04 Thread nalaginrut
> > In many systems it is desirable for constants (i.e. the values of literal > > expressions) to reside in read-only-memory. To express this, it is > > convenient to imagine that every object that denotes locations is > > associated with a flag telling whether that object is mutable or >