[Larceny-users] Stupid newbie or a bug?

Felix Klock felixluser at pnkfx.org
Tue Jul 1 21:46:34 EDT 2008


Jon-

That error message could be be improved significantly.  I'll file a  
ticket about this, since I think the mistake you made is likely to be  
made by other users of Larceny.

I think the expected usage syntax for buffer-mode is this:

 > (buffer-mode line)

as opposed to what you wrote, which was (buffer-mode (quote line))

I think the confusion here arises because the text of the R6RS refers  
to the operand of buffer-mode as "a symbol whose name is one of none,  
line, and block", so it would seem like one should write (buffer-mode  
(quote line)).  However, buffer-mode is syntax, not a procedure; so  
the text is talking about the operand of buffer mode in terms of the  
abstract syntax tree associated with (buffer-mode ...), not a dynamic  
evaluation of the operand of buffer-mode as if (buffer-mode ...) were  
a procedure application.

Anyway, in Larceny, when I do (buffer-mode line), the form evaluates  
to the same symbol that 'line evaluates to; it also prints the  
following warning message the first time I evaluate it:

> WARNING: buffer-mode
>     is deprecated in Larceny.  See
>     http://larceny.ccs.neu.edu/larceny-trac/wiki/DeprecatedFeatures
>

There is some alternative approach that should work in Larceny,  
because buffer-mode has been deprecated in Larceny.  The link in that  
warning message is currently dead, but I was able to find the relevant  
text at that page through other means, so I am copying it here for  
completeness:

> The R6RS forbids buffer-mode and buffer-mode? to recognize Larceny's  
> datum mode, which is the buffer mode recommended for interactive  
> output ports. This is likely to be an error in the R6RS, but  
> repairing this error would make buffer-mode equivalent to quote (but  
> less efficient) and buffer-mode? equivalent to symbol? (but less  
> efficient), so these features would still be deprecated. Use quote  
> instead of buffer-mode. (There is no conceivable use for buffer- 
> mode? anyway, so warning against its use would be redundant.)


I do not know if the alternative approach suggested in the quoted  
paragraph above would constitute portable R6RS code.

-Felix


On Jul 1, 2008, at 8:06 PM, Jon Wells wrote:

> (buffer-mode mode) doesn't seem to work. I futzed to no avail.
>
> jon.
>
>
> jon at pow 114% larceny -err5rs
> Larceny v0.961 "Fluoridation" (Jan  2 2008 08:01:50,  
> precise:Linux:unified)
> larceny.heap, built on Wed Jan  2 08:11:02 EST 2008
> ERR5RS mode (no libraries have been imported)
>
>> (import (rnrs))
> Autoloading (rnrs)
>      :
> Autoloading (rnrs unicode)
>
>> (buffer-mode 'line)
>
> Syntax violation: invalid reference
>
> No binding available for memq in library (rnrs io ports)
>
> Form: memq
>
> Trace:
>
>  (memq mode '(none line block))
>
>  (if (memq mode '(none line block))
>    mode
>    (assertion-violation
>      'buffer-mode
>      "Larceny-specific buffer mode"
>      mode))
>
>  (lambda (mode)
>  (if (memq mode '(none line block))
>      mode
>      (assertion-violation
>        'buffer-mode
>        "Larceny-specific buffer mode"
>        mode)))
>
>  ((lambda (mode)
>   (if (memq mode '(none line block))
>       mode
>       (assertion-violation
>         'buffer-mode
>         "Larceny-specific buffer mode"
>         mode)))
> ''line)
>
>
>
> Error: syntax-violation: invalid reference: No binding available for  
> memq in
> library (rnrs io ports) memq
> Entering debugger; type "?" for help.
> debug>
>
>
> _______________________________________________
> Larceny-users mailing list
> Larceny-users at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/larceny-users




More information about the Larceny-users mailing list