johnlcox / motif

Scala-like pattern matching for Java 8
http://john.leacox.com/motif
Apache License 2.0
148 stars 4 forks source link

Add primitive type patterns #4

Closed johnlcox closed 9 years ago

johnlcox commented 9 years ago

Is there any value in creating actual primitive patterns similar to what Java 8 did with classes like IntFunction? I could create IntPattern and IntConsumablePattern for each primitive type. It's probably best to create some benchmarks to compare how bad the autoboxing will be using just Pattern and ConsumablePattern.

johnlcox commented 9 years ago

Based on the benchmarks in 3f27ea4c76709574f7e68caaf6c82d7ab514d2e9 and the fact that each primitive type will require about 6 classes it doesn't seem worth it to add primitive type patterns at this time.

johnlcox commented 9 years ago

Reopening and using this to track adding boxed primitive patterns. If actual primitive patterns are needed at a later date a separate issue can be logged for that.