<< Back to previous view

[CLJS-353] Use different primitives for array access and property/object access Created: 09/Aug/12  Updated: 11/Mar/15  Resolved: 11/Mar/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: Raphaël AMIARD Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None

Attachments: Text File 0001-CLJS-353-Use-different-primitives-for-array-access-a.patch     Text File 0001-CLJS-353-Use-different-primitives-for-array-access-a.patch    


In javascript, array access (array[index]) and property access (object["property"]) have the same syntax, hence aget/aset are used for both in the core library.

But this isn't true for every target language. For example in Lua, there are no arrays, so if you want to have an array like container, array access will need to go through a function.

This patch proposes to add new builtins : oget and oset (for obj-get obj-set) and use them where appropriate. The generated code will be the same for javascript, but will enable alternate backend implementers to treat both differently

Comment by Raphaël AMIARD [ 09/Aug/12 7:24 AM ]

All test pass

Comment by David Nolen [ 09/Aug/12 5:26 PM ]

Not sure I like the names oget/set. How about obj-get obj-set?

Comment by Raphaël AMIARD [ 10/Aug/12 4:08 AM ]

fine by me, added a new patch !

Comment by David Nolen [ 10/Aug/12 11:07 AM ]

The patches are identical.

Comment by David Nolen [ 11/Mar/15 2:29 PM ]

Not going to do this, so far no other actively developed ClojureScript alternative require it.

Generated at Sun Jan 21 20:55:37 CST 2018 using JIRA 4.4#649-r158309.