<< Back to previous view

[MATCH-4] Optimized pattern matching on deftype/record, POJOs Created: 04/Sep/11  Updated: 11/Aug/13

Status: Open
Project: core.match
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: David Nolen Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

(match [x]
  [({:a 0 :b 1} :type Foo)] :a0

:a and :b would be converted to field access, i.e. (.a x)

As with primitive array matching, we should do an instance check followed by hinted field access.

We should consider adopting the deftype/record syntax.

Comment by David Nolen [ 27/Oct/11 4:41 PM ]
(match [x]
  [^Foo {.-bar 5 .-baz 7}] :a0
  [^Foo {.-bar _ .-woz 8}] :a1
  :else :a2)

Given the recent ClojureScript property access discussions this seems like an acceptable syntax for high-performance property access.


(match [^Foo x]
  [{.-bar 5 .-baz 7}] :a0
  [{.-bar _ .-woz 8}] :a1
  :else :a2)

But probably not since then we should probably throw if someone tries to declare a different type in the row.

Comment by Ron Pressler [ 10/Aug/13 4:57 PM ]

Hi. Any plans on resolving this?

Comment by David Nolen [ 11/Aug/13 10:55 AM ]

I have no specific timeline, it will definitely be after 0.2.0, only focusing on bugs at the moment.

Generated at Wed Apr 01 08:18:53 CDT 2015 using JIRA 4.4#649-r158309.