[plt-scheme] primitive vs. procedure in 3.99

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 4 07:14:11 EDT 2008

Yes, that's an intentional change. (Actually, it's even listed in the
"MzScheme_4.txt" release notes.)

The term "primitive" is misleading; it really just means "implemented
in C". We changed the printing because "implemented using C" is rarely
useful information, and we'd like to be able to re-implement functions
in Scheme at any time.

The `primitive-result-arity' function is an odd bit of reflection that
probably should be replaced by a table mapping bindings (as opposed to
values) with information about the binding; that would be equally
useful to compiler tools, at least.

Matthew

At Wed, 4 Jun 2008 01:09:24 -0700, "Mark Engelberg" wrote:
> I'm referring to this behavior:
> > +
> #<procedure:+>
> 
> as opposed to something like
> #<primitive:+>
> 
> On Tue, Jun 3, 2008 at 11:55 PM, Jos Koot <jos.koot at telefonica.net> wrote:
> > I see no problem:
> >
> > Welcome to DrScheme, version 3.99.0.26-svn3jun2008 [3m].
> > Language: Module custom.
> >>
> >> (primitive? +)
> >
> > #t
> >>
> >> (procedure? +)
> >
> > #t
> >>
> >> (procedure? (lambda () '()))
> >
> > #t
> >>
> >> (primitive? (lambda () '()))
> >
> > #f
> >>
> >
> > All primitive procedures are procedures, of course.
> > Jos
> > ----- Original Message ----- From: "Mark Engelberg"
> > <mark.engelberg at gmail.com>
> > To: "pltscheme" <plt-scheme at list.cs.brown.edu>
> > Sent: Wednesday, June 04, 2008 7:37 AM
> > Subject: [plt-scheme] primitive vs. procedure in 3.99
> >
> >
> >> Is this a bug?
> >>
> >> In 3.72, some things were categorized as primitives, and some were
> >> categorized as procedures.  For example, + is a primitive, and is
> >> reported as such by the REPL.  On the other hand, (lambda (x) x) is a
> >> procedure.
> >>
> >> The distinction matters, because some functions, such as
> >> primitive-result-arity only work on primitives.
> >>
> >> However, in 3.99, all primitives are reported as procedures by the
> >> REPL.  They are still internally classified as primitives, so they
> >> work with primitive-result-arity, but there is no easy way to find out
> >> from the REPL whether they are primitives or procedures.
> >>
> >> --Mark



Posted on the users mailing list.