get/set dilemma
Posted: Thu Aug 04, 2011 3:28 am
Hello boys/girls (there's any girl here?). I've a question. I've read here
http://axisofeval.blogspot.com/search?u ... results=23
a question about the today existence of CAR and CDR functions on new lisp dialects. This have bring to me a consideration on my dialect. I try to expose to you my dilemma.
My system define structures like packages, funtions, structures, types in an anonymous way. A type can be created in this manner:
and create an object of type types:type. Then
will make an object of type types:2d-point with X and Y set to 0. Ok? Good!! The type object have the name "2d-point" because is registered into the package TYPES. Technically TYPES is a package that contain symbols whose values is a named type.
In the following instruction, the type have no name, because is not registered into TYPES:
In few words, this permit to use unnamed packages, unnamed types and so on. Package definitions work in the same manner.
Ok ?? GOOOOD!!!
So ... reading that link, where the author say to use structures for CONSES .. make me thinking that CAR and CDR can be fields of a structure, and so name and nicknames of types or packages can be fields of a structure too.
Then if I wanna know the name of a type I probably wanna write something like this:
But, if "type" is a field defined by the user??
I wanna still have the possibility to get the type of x which is TYPES:MY-TYPE. Same problem on packages: the type of the object (types:package) or the value of the symbol "type" defined into the package?
The goal is to remove functions like
How can I resolve this problem?
Thank you.
http://axisofeval.blogspot.com/search?u ... results=23
a question about the today existence of CAR and CDR functions on new lisp dialects. This have bring to me a consideration on my dialect. I try to expose to you my dilemma.
My system define structures like packages, funtions, structures, types in an anonymous way. A type can be created in this manner:
Code: Select all
(define types:2d-point (type nil :x :y)) ---> #<type |2d-point| (x y)>
Code: Select all
(struct types:2d-point :x 0 :y 0) ---> #S(2d-point x 0 y 0)
In the following instruction, the type have no name, because is not registered into TYPES:
Code: Select all
(struct (type nil :x :y) :x 0 :y 0) ---> #S(#16:00E49E88 x 0 y 0)
Ok ?? GOOOOD!!!
So ... reading that link, where the author say to use structures for CONSES .. make me thinking that CAR and CDR can be fields of a structure, and so name and nicknames of types or packages can be fields of a structure too.
Then if I wanna know the name of a type I probably wanna write something like this:
Code: Select all
(get :type X) ---> types:my-type
Code: Select all
(define types:my-type (type nil :type :x :y))
(define x (struct types:my-type :type "XY" :x 0 :y 0))
(get :type x) --- ????
The goal is to remove functions like
- name-of
nicknames-of
imaginary-of
real-of
sign
packages-of
car
cdr
set-car
set-cdr
size-of
type-of
How can I resolve this problem?
Thank you.