FYI: setItem changes

Freeform discussion about anything related to modding Transcendence.
Post Reply
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

In 1.08e I've made a change to the return value of setItem. Instead of returning the value that was just set, it now returns the entire structure or array. This makes it compatible with lnkAppend and others.

For example, now you can do something like this:

Code: Select all

(block (myStruct)
   (setq myStruct (setItem nil 'a 'b))
   )
I've also made a bunch of other improvements to setItem:

1. Just to shorten the syntax, set@ is an alias for setItem and @ is an alias for item.
2. (set@ struct1 struct2) returns the merge of the two structures.
3. set@ now works if the target variable is nil. For example:

Code: Select all

(setq test nil)
(set@ test 'a 'b) -> { a:b }
test -> { a:b }
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Thanks George. Those changes look good. I think i kight like the new @ syntax :)
Get your own Galactic Omni Device
Get it now. It's free!!
Image
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

The truth is that I've been doing a lot of JavaScript programming lately (for Anacreon) and I really like their use of structs (objects). The TLisp syntax will never be that clean, but we can definitely do similar things. Now all we need is a way to access "this" and we could do object methods.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

george moromisato wrote:The truth is that I've been doing a lot of JavaScript programming lately (for Anacreon) and I really like their use of structs (objects). The TLisp syntax will never be that clean, but we can definitely do similar things. Now all we need is a way to access "this" and we could do object methods.
Yeah, javascript is becoming a really nice language. You shouldn't by any chance be running it on the serverside with nodejs btw?
Get your own Galactic Omni Device
Get it now. It's free!!
Image
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:
george moromisato wrote:The truth is that I've been doing a lot of JavaScript programming lately (for Anacreon) and I really like their use of structs (objects). The TLisp syntax will never be that clean, but we can definitely do similar things. Now all we need is a way to access "this" and we could do object methods.
Yeah, javascript is becoming a really nice language. You shouldn't by any chance be running it on the serverside with nodejs btw?
No, sorry. For the Multiverse I'm running an improved version of TLisp (called HexeLisp), believe it or not. For Anacreon the server is almost all C++ with a thin layer of HexeLisp.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Hehe, ok :) You do enjoy writing your own languages it seems :) Cudos for that.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Post Reply