Prothon Terminology Suggestions

 

Data – numbers, strings, dictionaries, or any other "passive" objects in memory.

 

Function – a statement which performs some action, typically having "arguments" and a "return value", which can be any object.  Functions have a local scope (a namespace independent of the surrounding code).

 

Object – a number, a function, or any other entity that can be associated with a "variable", and that has a unique location in memory.

 

Variable – a name referring to an object in memory.  Different variables can refer to the same object.

 

Assignment – Setting a variable name to reference a specific object in memory.  x = "abc" assigns a local variable x to a string object.

 

Attachment – A variable is "attached" to an object when it has an entry in the namespace dictionary ( __dict__ ) of that object.  A variable may be an "attribute" of an object without being attached, if it is in the namespace of an ancestor.

 

Instance Variable – a variable with a leading dot (e.g. .var1 )  These are used in function definitions to refer to a variable like X.var1 where X is an object which will call the function.  Instance Variables are usually attached to instances of the prototype in which they are defined.  The setting or accessing of an instance variable occurs when the function is called, not when it is defined.

 

Binding -- setting up a linkage between a function and a particular object, so that when the function is called, any "instance variables" in that function will be resolved by searching that object and its ancestors.  Binding occurs before the function is called, sometimes long before, and in a distant part of the code.  Bound functions are objects that may be referenced with a variable name and called like a normal function.  Binding is permanent.  Bound functions keep their bind object even when passed to another scope.  Unbound functions must be bound to an instance of the expected type before they can be called.

 

Prototype – a collection of data and functions that is to be used as a pattern or template from which "instance" objects are created.  Prototypes serve as a container object for the variables in their namespace.

 

Instance – an object created by "instantiation" of a prototype, or another instance serving as a prototype.  Instantiation means defining a separate object with the same variables as the prototype, adding any new variables that may be defined in the instantiation statement, then running an "initiator" function (if it exists) to initialize the instance.  Each instance has its own namespace.

 

Initiator – a function defined in a prototype that initializes each new instance of the prototype.  It has a special name __init__ and it runs automatically as the last step of an instantiation.

 

Initialize -- run the __init__ function in the namespace of a newly created instance.

 

Inherit – Collect the data and functions from other prototypes and instances, resolve any conflicts between them, and create a new object with the combined data and functions of its "ancestors".

 

Ancestor (of X) – the parent of X, or any of its parents, on up to the primitive object.

 

Descendant (of X) --  an object derived from X or any of its descendants.

 

Clone  ???

 

Clone-able Object ??? – prototype or instance

 

{Python terms to be deprecated in Prothon}  ???

 

{Class} – not used in Prothon.

– an object from which other similar objects are instantiated.  Similar to a prototype.

 

{Attribute} – same as variable -- a general term for a name referring to any data or function attached to an object.  Since all variables in Prothon are attached to objects, the distinction between variable and attribute is unnecessary.

 

{Method}

-- a function designed to work with a particular kind of object.  All methods are functions, but not all functions are methods.

– in Prothon, a function defined within a prototype or instance.  Since all functions in Prothon have the same form, regardless of where they are defined, the distinction between method and function can usually be ignored.

– in Python, a structure similar to a function, defined within a class, often with special forms to accomodate different ways variables are shared between classes and instances (instance method, static method, class method ).

 

{Constructor}

-- same as initiator.  Constructor has connotations of building something new, more like what is done by the .proto() function.  Although the initiator *can* add new functions to an object, it is most often used to set values.  For new users, the word initiator will be more easily associated with the function __init__().