[Types-sig] New syntax?

Tim Peters tim_one@email.msn.com
Thu, 16 Dec 1999 23:05:51 -0500


[GregS]
> ...
> In fact, I don't even like Tim's notion of declaring a function since a
> "def" is more than adequate for doing that.

I thought it would be easier to get one new stmt than to modify existing
stmts, and *much* easier to write a dirt-simple tool to strip them out again
(vis a vis Guido's requirement).

In real life I would certainly prefer annotating "def" stmts directly.  I
think a declaration statement needs the *ability* to specify full function
signatures, though; e.g.,

decl handlerMap: {String: def(Int, Int)->Int}

handlerMap = {"+": lambda x, y: x+y,
              "*": lambda x, y: x*y,
              ...
             }

In either case, I'm not sure what to do about varargs (the "*rest" form of
argument).

> ...
> Note the use of "decl class ..." to define class variables, while
> "decl ..." is for member variables. I'm not sure if we should
> instead use Tim's suggestion of "decl member ...", though.

I am:  I didn't think about this at all.  Member vrbls are far more common
than class vrbls, so practicality beats purity <wink>.

> Given the position of the declaration, I think "decl member" might
> actually be better because it makes it clear that <b> is a *member*
> variable, despite being in a location that is normally used for class
> variables.

That's the purity argument <2.0 wink>.

> An alternative would be a different "decl" keyword just
> for members.

And that's the bozo argument <3.0 wink>.  "decl" doesn't mean "here's a
variable", it means "here's a declaration of 'something'"; e.g., on some
days I would have killed to be able to say:

    decl builtin int, ord  # stop looking these up in the inner loop!

In fact, I think of "decl" as a devious way of writing "pragma" -- and all
that that implies.

although-less-than-that-demands-ly y'rs  - tim