Re: [Readable-discuss] Reorganize to reduce namespace pollution and maximally create library
Am 25.11.2013 23:16, schrieb David A. Wheeler: David A. Wheeler scripsit: How about cond-expands at the beginning to handle much of the shimming, On Mon, 25 Nov 2013 12:08:47 -0500, John Cowan co...@mercury.ccil.org wrote: As of the last time I looked, cond-expand wasn't supported by Racket, Scheme48/scsh, Larceny, Ypsilon, S7, or Sizzle. Whow! What an impressive list! It just gets worser and worser. Putting the text in *different* files and leaving them there *also* appears to be non-portable: * R5RS load doesn't guarantee that loading is relative to the directory of the current file (or provide any other guarantee about current directory), and has no include at all. * R7RS does have include (4.1.7. Inclusion), though it merely encourages searching the same directory as the caller of include (and certainly doesn't guarantee searching there FIRST, so it's just begging for security vulnerabilities just like PATH=.:$PATH). Plus: different compilers will need specific care anyway. After all, you don't want to use load at all, since it may compile into a call to load with a given file name, which defeats the very purpose of compilation. Maybe it's time to break out cpp or sed :-(, or use some other tool to generate various files for different Scheme implementations. At this point it might be rather easy to explain a second (and more general) use case of my idea of having a Scheme reader which returns comments are nodes in the AST. I already wrote such a tool for my own purpose (even though does currently not include comments in the translated files, which is not bad in principle, but still bad in practise). Helps me to expand cond-expand sections, overcome my inability to get hygienic macros work in rscheme and expand some parsers written using lalr for chicken. It even implements the make macro from PLT (which I tested by writing a replacement of the make process for chicken)... Neatly a tool but see below... The configure program already modifies the file anyway, so that might not be insane. Hm. Depends on the stance you take wrt. configure. ;-/ At the least, I could put things in different files, and then use cat to create files usable to different systems. Not too bad and idea. While it might not scale to whole programs, it's certainly a valid way to get things done for something the size of a srfi's implementation. I'll note that my Common Lisp implementation just works, and it even overrides the reader. In contrast, a common answer seems to be don't bother trying to write portable Scheme: http://stackoverflow.com/questions/11062320/writing-portable-scheme-code-is-anything-standard-beyond-r5rs-itself Thanks for this pointer. It took me to http://www.ccs.neu.edu/home/dorai/scmxlate/ which I have not yet heard about. There is so much we don't ever see. Maybe I can retire the preprocessor mentioned above. Though probably not: just found out that at minimum I would have to add rscheme to scmxlate. Also it seems a bit hard to use and even harder to use in batch mode. I *like* Scheme, but it's starting to feel like an abusive relationship :-). Yeah, sometimes I feel that way too. John, how do you manage to keep a positive mood when dealing with so many implementations? -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk___ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss
Re: [Readable-discuss] using t-expressions
Am 25.11.2013 15:14, schrieb David A. Wheeler: On Mon, 25 Nov 2013 12:24:23 +0100, Jörg F. Wittenberger joerg.wittenber...@softeyes.net wrote: Hi all, I'm just making my first experiences in actually using srfi-110. At this point I find myself forced to make serious changes to the program logic. Beyond what's supported by simply configuring the source code. The worst thing I found that it will complain on the error port when reading badly formatted code and then continue to read. I really, really need it to do what other Scheme readers usually do: error out. Easily done, and there are many ways to do it. The ONLY procedure that throws an exception is read-error: (define (read-error message) I changed it's signature to match srfi-23 (for know) (: read-error (string rest * - *) This allows me to do as better job at error reporting. But I tend to prefer a more restrictive, though compatible, syntax in this case (: read-error (string input-port string rest * - *) Whereby I'd require all calls to read-error to pass the port and the last successfully read token in an effort to further improve error messages. But I'm unsure about this. Any comments? (display Error: (current-error-port)) (display message (current-error-port)) (newline (current-error-port)) (flush-output-port (current-error-port)) (raise 'readable) '()) The ONLY procedure that catches an exception is t-expr-catch: (define (t-expr-catch port) (init-sweet) (guard (exception ((eq? exception 'readable) (read-to-unindented-line port) (t-expr-catch port))) (t-expr port))) Is there actually any scheme implementation which benefits from this catching? I can't image. I'd feel it might be good to provide a clean up read like `read-to-unindented-line` to help the implementor of a repl. But for the default it just does not feel right to me. /Jörg -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk ___ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss
Re: [Readable-discuss] Reorganize to reduce namespace pollution and maximally create library
I said: I'll note that my Common Lisp implementation just works, On Tue, 26 Nov 2013 11:29:49 -0500, John Cowan co...@mercury.ccil.org wrote: Well, yes. Common Lisp is a pretty thorough standard, and as such it has a fairly large number of actively developed implementations, as languages go: ABCL, CCL, CLISP, CMUCL, ECL, MKCL, SBCL. But that's nothing compared to Scheme's seventy-seven or so. It's not the number of implementations, it's the lack of a widely-implemented standard way to invoke basic capabilities, such as a module system, exception system, and hash tables. Heck, not even macros (a Lisp basic) are completely universal. If there were 77 Schemes that agreed on all those, it'd be fine. As a developer, I stick to Chicken and Chibi, and resolutely ignore the (mis)behavior of other Schemes. I have the same basic approach (using guile as the list). Here's hoping that R7RS, especially R7RS-large, will make it possible to unify the islands. I think Scheme would be more compelling if people could actually work together :-). --- David A. Wheeler -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk ___ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss
Re: [Readable-discuss] using t-expressions
I said: The ONLY procedure that throws an exception is read-error: (define (read-error message) On Tue, 26 Nov 2013 15:11:39 +0100, Jörg F. Wittenberger wrote: I changed it's signature to match srfi-23 (for know) (: read-error (string rest * - *) Okay, but you'll need to modify the procedure definition to match. But I tend to prefer a more restrictive, though compatible, syntax in this case (: read-error (string input-port string rest * - *) Please don't. The intent was to be syntactically consistent with error as defined in srfi-23 and R7RS. Someone can always modify the error port to change where it goes. Oh, I presume you mean output-port not input-port there. Whereby I'd require all calls to read-error to pass the port and the last successfully read token in an effort to further improve error messages. Why not just pass last successfully read token as a parameter after the string? The ONLY procedure that catches an exception is t-expr-catch: (define (t-expr-catch port) (init-sweet) (guard (exception ((eq? exception 'readable) (read-to-unindented-line port) (t-expr-catch port))) (t-expr port))) Is there actually any scheme implementation which benefits from this catching? I can't image. Our processing program does, because it tries to process as well as it can. But we could change the interface. I'd feel it might be good to provide a clean up read like `read-to-unindented-line` to help the implementor of a repl. But for the default it just does not feel right to me. Okay. An easy approach would be to raise an exception on error, and add an option to permit the current behavior (catch and retry). That's an interface change, but the SRFI doesn't define specifics on how to handle errors (since Schemes vary in this matter), and it makes sense that people will want to get errors. Guile 1.8 doesn't support srfi-23 or R7RS, so that would need to be implemented separately on guile. --- David A. Wheeler -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk ___ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss
Re: [Readable-discuss] Reorganize to reduce namespace pollution and maximally create library
I said: At the least, I could put things in different files, and then use cat to create files usable to different systems. On Tue, 26 Nov 2013 14:47:36 +0100, Jörg F. Wittenberger: Not too bad and idea. While it might not scale to whole programs, it's certainly a valid way to get things done for something the size of a srfi's implementation. Right. This thing is small. I don't see anything good for trivial preprocessing: * scmxlate appears too complex to get going. * cpp is a disaster for Lisp (it wants to parse '...' as character constants) * m4 is easy to get wrong, and has too much functionality. I think I could create a simple #ifdef ... #elifdef... #else... #endif preprocessor in awk (which is in the POSIX standard) that would do the job. Then the whole thing could be in one file, and generate variations for different purposes. For those Schemes with cond-expand, we could put them in one file, so we wouldn't have to generate too many files. --- David A. Wheeler -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk ___ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss