[Types-sig] PyDL RFC 0.01

scott scott@chronis.pobox.com
Mon, 27 Dec 1999 00:15:24 -0500


On Sun, Dec 26, 1999 at 10:45:12PM -0500, Paul Prescod wrote:
> I've been off-list for a few days so if this RFC doesn't include the
> last few day's feedback, I apologize in advance.

Very grateful for you providing some more centralized direction with
this RFC.  Some questions follow, mostly intended to make sure I'm on
the same page as the intent of the RFC.  
> 
> PyDL RFC 0.01
> =============
[...]
> 
> An interface is a Python object with the following attributes:
> 
> __conforms__ : def (obj: Any ) -> boolean
> __class_conforms__ : def (obj: Class ) -> boolean

What is the rational behind separating __conforms__ and
__class_conforms__? It seems to me like __conforms__ could do 
everything __class_conforms__ is supposed to.  Am I missing something? 

[...]
[...] 
> Type expression language:
> =========================
> 
> Type expressions are used to declare the types of variables and to
> make new types. In a type expression you may:
> 
> 1. refer to a "dotted name" (local name or name in an imported module)
> 
> 2. make a union of two or more types:
> 
> integer or float or complex
> 
> 3. parametrize a type:
> 
> Array( Integer, 50 )
By `50', do you intend length of 50?

> 
> Note that the arguments can be either types or simple Python
> expressions. A "simple" Python expression is an expression that does
> not involve a function call.
> 
> 4. use a syntactic shortcut:
> 
> [Foo] => Sequence( Foo ) # sequence of Foo's
> {a:b} => Mapping( a, b ) # Mapping from a's to b's
> (a,b,c) => Record( a, b, c ) # 3-element sequence of type a, followed by
> b
> followed by c
> 
> 5. Declare un-modifability:
> 
> const [const Array( Integer )]

By nesting const declarations, do you intend that checks against
modifiability at runtime are shallow? For example, if I declare
array A as a constant array of Foo instances, are those foo instances
(or their attributes) modifiable?

> 
> Declarations in a PyDL file:
> ============================
> 
> (formal grammar to follow)
> 
>  1. Imports
> 
> An import statement in an interface file loads another interface file.

Do you envision the import statement to be similar in syntax to 
regular python?  (eg from m import v; from m2 import *)
> 
>  2. Basic attribute type declarations:
> 
> decl myint as Integer                   # basic 
> decl intarr as Array( Integer, 50 )     # parameterized
> decl intarr2 as Array( size = 40, elements = Integer ) 
> 					# using keyword syntax
> 
> Attribute declarations are not parameteriable. Furthermore, they must
> resolve to fully parameterized (not parameterizable!) types.

what do you mean by 'attribute declarations'?  I'd hate to see
classes that couldn't have attributes that are parameterizable, but 
agree that resolving parameters needs to end somewhere.

[...]
>  5. Interface declarations:
> 
> interface (_x,_y) foo(a, b ):
>     decl shared somemember as _x
>     decl someOtherMember as _y
>     decl shared const someClassAttr as List( _x )
> 
>     decl shared const someFunction as def( a: Integer, b: Float ) ->
> String

what do you mean by 'shared' in the above?  Are you referring to the
distinction between class attributes and instance attributes?

[...]

> The Undefined Object:
> =====================
> 
> The undefined object is used as the value of unassigned attributes and
> the return value of functions that do not return a value. It may not
> be bound to a name.

By functions that do not return a value, do you mean functions that
return None, or that may return None?

> 
> a = Undefined   # raises UndefinedValueError
> a = b           # raises UndefinedValueError if b has not been assigned

by 'b has not been assigned', do you mean assigned a type, or is this
in your view a replacement for NameError?  I'm a little unclear where
your going with Undefined.

> 
> Undefined CAN be compared.
> 
> if a==Undefined:
>     blah
>     blah
>     blah
> 

scott