[Grace-core] On numbers and objects
Michael Kölling
M.Kolling at kent.ac.uk
Tue Nov 9 13:23:55 PST 2010
On 9 Nov 2010, at 08:11, James Noble wrote:
>>>> The hard part is what about constructors for *user-defined value types*.
>>>> Do they always run? Or run most of the time? Or run, but then the object may be deleted
>>>> and replaced with an indistinguishable clone?
>
> so: the point here is that we can have user-defined objects
> with all-constant fields (i.e. all fields defined by let).
>
> Compared with EGAL, these will have the same behaviour as
> "built in" objects like strings, in that the program will not be able to
> tell if there is one share copy or many duplicated copies - its an
> implementation issue. But if their constructors can have side
> effects, the program will be able to tell if the constructors
> were executed or not.
>
> so that's the issue.
I think all objects that have literals (Boolean, Number, String) cannot have constructors. These objects pre-exist, and literals are provided as constant references to those objects. Objects that have constructors cannot have literals.
mik
More information about the Grace-core
mailing list