Re: Static/Strong/Implicit Typing

From: sajiimori (myusername_at_hotmail.com)
Date: 01/27/04


Date: Tue, 27 Jan 2004 03:37:06 GMT


> Then I can't use the sequence functions of Common Lisp that
> accept both lists and vectors. I can't use the nice flexible
> arithmetic functions.

You could if the functions had multiple versions, and the compiler inserted
calls to the appropriate ones (since it has all the static type information
it needs to make that determination).

> Next: I can't write macros any more. To define a macro,
> you define a function that operates on source code.
> And embedded in that source code there may be all kinds
> of objects. Numbers of various kinds, symbols, cons cells
> (for code or data), arrays, strings, blah, blah, blah.
> This is not a situation that static type systems tend
> to handle well.

That is very important. I wonder why nobody else had mentioned it (that I
saw anyway)?

> Suppose we define a discriminated union
> type that can contain anything that can appear literally
> in source code, and then build our representation of code
> out of that.

This is what I was thinking.

> (It would probably be necessary to forbid
> user-defined types appearing here, but maybe that's not
> so terrible.)

Don't user-defined types have to be based on built-in types anyway?

> Next: I can't have arbitrary-length inhomogeneous lists
> any more.

I don't see the problem with allowing arbitrary length, but having to use
homogeneous lists... yeah, that could be inconvenient. Trying to re-add
them would just make the language more complicated (like Java).

> Next: I can't do exploratory programming so well any more.
> I can't take my running web server program and decide that
> I need such-and-such a function to accept strings as well
> as symbols, type in a new definition of that function,
> and have everything just go on working.

Right.

> Next: I have trouble imagining how CLOS is going to carry
> on working.

It won't. Next! ;-)

> Does someone have
> a design for a statically typed Lisp that wouldn't feel
> really un-Lispy to work with? For instance, do you?

Nope, just been toying with the idea.

> Erik Naggum observed that you can *already* consider CL
> to be strongly, statically, implicitly typed, with everything
> having type T.

Still sounds like a joke. Implementing such a type system requires exactly
0 lines of code. Its requirements are necessarily met. It's like a type
system that requires that objects are not of negative size.

> So if you want to ask questions
> about a "statically typed Lisp" then you ought to be more
> specific about just how fine-grained you want that partition
> to be, and why.

Akin to Haskell. And...umm...because I feel like it? =)



Relevant Pages

  • Re: Lisp indenting tool
    ... It is based on a huge machinery defined in ANSI Common Lisp. ... From my experience with Mathematica, this is not possible when the ... solution is based on the compiler taking source code as input (since ... which are genuine exception to the nested paren syntax. ...
    (comp.lang.lisp)
  • Re: Integer with base preserved!
    ... | To be able to operate upon source code at the list level requires the ... Common Lisp is not defined on the character strings that make up the ... character sequence that made up the document. ... Why involve the whole world in your imagination in a negative way like ...
    (comp.lang.lisp)
  • Re: Static/Strong/Implicit Typing
    ... >> accept both lists and vectors. ... >> you define a function that operates on source code. ... In a H-M-ish type system, ... >> a design for a statically typed Lisp that wouldn't feel ...
    (comp.lang.lisp)
  • Re: Source Code Wiki Start-Up Community
    ... migrating code-snippets and source code into it over the last few ... lists of pixels. ... newly-found pixels getting put on the second. ... a typical stack) will fail gracefully if it runs out of memory. ...
    (comp.programming)
  • handbook - kernel build question
    ... In section 9.3 of the handbook just before the two procedures it lists ... "If you are building a new kernel without updating the source code ... Are the words update and upgrade the ... we are free to abandon sin." ...
    (freebsd-questions)