Re: Sacla loop: a new loop implementation

From: Gareth McCaughan (gareth.mccaughan_at_pobox.com)
Date: 10/19/04


Date: Mon, 18 Oct 2004 22:48:20 GMT

Antonio Menezes Leitao wrote:

> You are forgetting a fundamental issue. Macro expansion is a
> compile-time operation. If you create a Lisp that allows macros that
> require type information to compute the expansion then that
> information must be produced at compile time. And if you can produce
> useful type information at compile time, then you are working with a
> statically typed language. That's as simple as that.

Why on earth do you believe that "if you can produce useful
type information at compile time, then you are working with
a statically typed language"? That seems to me to be obviously,
ludicrously, false, unless you define some of those terms in
a non-standard way that makes your point uninteresting.

I claim:

  - A language in which it is never necessary to issue
    explicit type declarations, and in which it is commonplace
    for variables to have values of multiple different types,
    is not a "statically typed language".

  - Such a language may, none the less, have a compiler that
    can often deduce useful information about what types some
    variables (or other expressions) can have.

  - It still isn't a "statically typed language".

  - If it has such a compiler, then there's no obvious reason
    why that compiler shouldn't (when it can) provide type
    information to whatever macro-expansion facility it uses.

  - It still isn't a "statically typed language".

I think you do in fact appreciate this, because you said:

> Of course, if you say that you are willing to accept that your macros
> might need to expand without useful type information available, I
> seriously doubt that they will be any useful. And if your macros
> _demand_ useful type information then you will have to declare type
> information on the code that uses them.

Now, obviously you're an authority on the question of what
things you "seriously doubt". But if, as you say, you
seriously doubt that it's possible for compile-time (or,
more exactly, macro-expansion-time) type information to
be useful when it isn't always available, then *I* seriously
doubt that you've thought it through properly.

A good CL compiler (CMU CL, say) can do a *lot* of type
inference. Sometimes it can work out a lot about what type
something has, sometimes not. What it's able to work out
is enough to let it produce some very decent code, even
without explicit type declarations.

So we have an example of a system where not-always-available
type information is helpful. Why do you "seriously doubt"
that there might be other examples?

                            *

You've used the term "statically typed language" a lot,
and you've defined it in terms that are ambiguous because
a crucial quantifier is missing. Could you please say
which of the following (if any) is your definition?

  1 "A language in which type information is always
    available at compile time"

  2 "A language in which type information is usually
    available at compile time"

  3 "A language in which type information is often
    available at compile time"

  4 "A language in which type information is sometimes
    available at compile time, no matter how rarely"

Thanks.

-- 
Gareth McCaughan
.sig under construc


Relevant Pages

  • Re: Sacla loop: a new loop implementation
    ... way without demanding that the necessary type information is available ... necessary information for the macro to expand. ... > available at compile time" ... A statically typed language is a language where types are known at ...
    (comp.lang.lisp)
  • Re: Sacla loop: a new loop implementation
    ... > information must be produced at compile time. ... > useful type information at compile time, then you are working with a ... if you say that you are willing to accept that your macros ... > might need to expand without useful type information available, ...
    (comp.lang.lisp)
  • Re: Way to determine type of variable?
    ... > I would like to write a generic procedure that will take string or numeric ... Types are a compile ... So at run-time the type information does not exist ... anymore and thus such generic functions are impossible - there ...
    (comp.lang.c)
  • Re: Sacla loop: a new loop implementation
    ... > compile-time operation. ... > which is a language where you can get type information at compile ... available to it at compile time. ... the type information available to it at compile time ...
    (comp.lang.lisp)
  • Re: VB Compiler Warnings & other woes ...
    ... you will get this warning in vs 2005. ... > have a direct legacy language path of evolution to consider. ... >> compile time errors rather than runtime. ...
    (microsoft.public.dotnet.languages.vb)