[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 24 18:37:28 1995 
Subject:Autoloading typespecs 
From:Steve Knight 
Volume-ID:950125.01 

Hi,

Typespecs have been considerably expanded in POPLOG recently,
and I am left puzzled on a couple of points.  Firstly, is it
possible to write autoloadable typespecs -- I know that in
practice typespecs are bound to "secret" identifiers, but is
this a deliberately or accidentally undocumented feature?
Secondly, is there a neat way of constraining a field to 
only accept items with a particular key?  It would be sensible
if I could write ...

    defclass foo {
        foovec    : vector,
        fooproc   : procedure,
        foonumber : number
    };

And have the appropriate type names used.  My suspicion
is that it isn't.

I am inclined to the view that all recogniser procedures should 
be usable as types.  This might be made possible by a procedure 
    sysrecogniser( <name>, <procedure> )
which creates a p_typespec in the appropraite section with the
appropriate procedure.  Then it would be possible for "defclass"
and also "ObjectClass" to automatically generate sensible 
typespecs.

And while I am speculating, I believe that the current trick of
associating p_typespecs with variables (by appending ":typespec")
is a rather horrid way to do things.  It would be much nicer if 
it was possible to create new name spaces that obeyed the sectioning 
rules.  [At the moment it is straightforward to create new name spaces
that do *not* obey sectioning rules -- simply by using hash tables.]
At the moment, we have recordclass (and ObjectClass) definitions
following the convention of adding "_key" to create the name of 
the variable referring to the new key.  In both cases, it would
be better to have a namespace, "typespec" and "key" respectively,
in which the new names live.  If these namespaces followed the 
section visibility rules, everything would then work fine.  (Also, 
in these new name spaces we would still have the distinction between
lexical and permanent variables.)

Steve