<< Back to previous view

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

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

Type: Defect Priority: Minor
Reporter: Raphaël AMIARD Assignee: Unassigned
Resolution: Unresolved 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    

 Description   

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



 Comments   
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.

Generated at Thu Oct 30 11:24:06 CDT 2014 using JIRA 4.4#649-r158309.