[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 10 11:34:41 2000 
Subject:Re: List of Possible Poplog Projects 
From: 
Volume-ID:1000410.02 

In article <8cs960$13kr$1@grind.server.pavilion.net>,
	"Jason Handby" <jasonh@NOSPAMbigfoot.com> writes:
> I entirely agree. The most flexibility I find I need these days is the sort
> provided by C++, in which a variable can be declared as a base class type
> and can then point to any object of a type derived from that. At least that
> way the compiler can check that what you propose to do to the thing vaguely
> makes sense (in that there's some virtual function that could be called for
> the thing, whatever it turns out to be). That's about as untyped as I would
> want to get (although I see your point about "list" vs. "list of integers".
> C++ solves this kind of problem by using templates, which doesn't seem quite
> right to me; much more code than feels right gets generated in order to work
> within the typing constraints.) I suppose that one other advantage of
> untyped variables is that your number of temporaries for each function can
> be lower due to improved variable reuse, and so your implementation of
> Poplog is more likely to be able to "registerize" them for you. But if this
> is a consideration, it most probably means that your function is too big in
> any case.  I can't think of any other reason.

Well, I want a static type system that can handle the type of _applist_
and _maplist_, and I'm prepared to restrict *a little* what you can do
with those fine functions.

OO-style inheritance doesn't cut it. C++-style templates are a bad
approximation to ML-style polymorphism. Java-style distinctions between
"primitive types" and "class types" just serve to complicate that
which was already simple.

Pop's type system is currently used in far too rich a way for the "usual"
static type systems to capture enough of it for practical purposes.

Here's an exercise for those in favour of static typing. Suppose that
we add the syntax

    name: Type
    (name1, name2 ...): TypeLots

to variable & argument declarations, to express that _name_ had type _Type_,
and that the _namei_ had the components of _TypeLots_. Suppose that
_Type_ was an expression, an ordinary Pop expression *of course*, that
was evaluated to yeild a type.

What basic types and type operations would you design to accomodate
"most" normal use, without messing up some of our powerful idioms
(properties are procedures; anything is callable; false is often used
to mean `absent`; procedures have updaters; the open stack is sometimes
elegantly exploited)?

[I've played around with this before, and I know that Robin has too. It's
non-trivial. *Deeply* non-trivial.]

>> (And the ability to
>> use a variable without declaring it is a DISadvantage, not an advantage.)
> 
> Absolutely. As an undergraduate learning pop11, I switched this off as soon
> as I knew how. As a more experienced programmer, I'm, er, "surprised" that
> such a rich and fertile source of novice bugs is touted as a feature :-)))

Does Pop still have that? I've had it turned off for so long I forgot it was
still an option!

Beginners don't see why `E -> thing;` isn't good enough to tell The
Computer that that want to mess around with `thing`. It takes experience
at being burnt with mis-spellings etc to realise that All Variables Must
Be Declared, and then more experience with mutual recursion to realise
that this means Variables Must Be Declared Somewhere Sensible (ie not
necessarily in *prior* text).

-- 
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html