Clojure

Add record? predicate

Details

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

Description

Would like a predicate that can be used to check whether an object is an instance of a defrecord.

Patch: clj-394-add-predicate-for-record-3.diff

Approach: Use existing marker interface IRecord to add new record? predicate.

user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true

Screened by: Alex Miller

Activity

Rich Hickey made changes -
Field Original Value New Value
Fix Version/s Release 1.4 [ 10040 ]
Fix Version/s Backlog [ 10035 ]
Reporter Assembla Importer [ importer ]
Priority Blocker [ 1 ]
Rich Hickey made changes -
Priority Blocker [ 1 ] Minor [ 4 ]
Christopher Redinger made changes -
Fix Version/s Release 1.4 [ 10040 ]
Fix Version/s Release 1.5 [ 10150 ]
Devin Walters made changes -
Patch Code and Test [ 10002 ]
Attachment clj-394-add-predicates-for-type-and-record.diff [ 11590 ]
Stuart Halloway made changes -
Fix Version/s Release 1.5 [ 10150 ]
Fix Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Approval Vetted [ 10003 ]
Alex Miller made changes -
Description Sometimes one would like to know if an object is an instance of a deftype or a defrecord.
Add (possibly empty) marker Interfaces that allow an efficient test, plus test fns
'record?' and 'deftype?'.
Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-866-test-vars.patch}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.
Alex Miller made changes -
Description Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-866-test-vars.patch}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.
Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.
Alex Miller made changes -
Labels defrecord deftype
Alex Miller made changes -
Description Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.
Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record-2.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.

{code}
user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true
user=> (deftype T [])
user.T
user=> (def t (T.))
#'user/t
user=> (type? t)
true
{code}

*Screened by:* Alex Miller
Attachment clj-394-add-predicates-for-type-and-record-2.diff [ 12328 ]
Alex Miller made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Incomplete [ 10006 ]
Alex Miller made changes -
Description Would like a predicate that can be used to check whether an object is an instance of a deftype or a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record-2.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} and {{IType}} to add new {{record?}} and {{type?}} predicates.

{code}
user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true
user=> (deftype T [])
user.T
user=> (def t (T.))
#'user/t
user=> (type? t)
true
{code}

*Screened by:* Alex Miller
Would like a predicate that can be used to check whether an object is an instance of a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record-2.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} to add new {{record?}} predicate.

{code}
user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true
{code}

*Screened by:*
Summary Add marker Interfaces for defrecords and deftypes plus boolean test fns Add record? predicate
Alex Miller made changes -
Attachment clj-394-add-predicate-for-record-3.diff [ 12477 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Screened [ 10004 ]
Description Would like a predicate that can be used to check whether an object is an instance of a defrecord.

*Patch:* {{clj-394-add-predicates-for-type-and-record-2.diff}}

*Approach:* Use existing marker interfaces {{IRecord}} to add new {{record?}} predicate.

{code}
user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true
{code}

*Screened by:*
Would like a predicate that can be used to check whether an object is an instance of a defrecord.

*Patch:* {{clj-394-add-predicate-for-record-3.diff}}

*Approach:* Use existing marker interface {{IRecord}} to add new {{record?}} predicate.

{code}
user=> (defrecord Foo [x])
user.Foo
user=> (def f (->Foo 1))
#'user/f
user=> (record? f)
true
{code}

*Screened by:* Alex Miller
Attachment clj-394-add-predicate-for-record-3.diff [ 12478 ]
Labels defrecord deftype defrecord
Alex Miller made changes -
Attachment clj-394-add-predicate-for-record-3.diff [ 12477 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: