Clojure

defrecord/deftype enhancements from 1.3.0-alpha7

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: Release 1.3
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

The defrecord read/print functionality added in clojure-1.3.0-alpha7 based on ticket CLJ-374 provided a baseline semantics for the described functionality. However, there were some short-comings of the implementation that should be fixed, including:

  • Symbols not supported in the record/type reader form
  • Type forms are not performant as a result of being handled by print-dup
    • This also leads to a situation where hinting is problematic
  • The boxClass method uses Reflector
  • Emission of records pulls out k/v's to create new map to build new record. Record itself should be used instead
  • Factory fn should not restrict definition of record/type with >20 fields (see here)

The semantics of the 1.3.0-alpha7 behavior should remain intact (save for bug fixes that open more functionality).

Activity

Hide
Fogus added a comment -

Added patch with fixes and tests.

Show
Fogus added a comment - Added patch with fixes and tests.
Hide
Fogus added a comment -

Updated patch to account for records/types of >20 fields. (see here)

Show
Fogus added a comment - Updated patch to account for records/types of >20 fields. (see here)
Hide
Stuart Halloway added a comment -

rest args such as overage in build-positional-factory are not clojure.lang.Indexed. Possible perf issue for (n - 20) calls to nth creating large records?

Show
Stuart Halloway added a comment - rest args such as overage in build-positional-factory are not clojure.lang.Indexed. Possible perf issue for (n - 20) calls to nth creating large records?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: