Clojure

Remove support for non-primitive bit-shift operations

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Per Rich's comment:

Shift ops would be limited to primitives only. Default versions 64-bit, but explicit shift-int versions for 32 bits.

Activity

Hide
Alexander Taggart added a comment - - edited

Rather than changing the behaviour of the extant unchecked ops (see the original discussion), I've created three new namespaces:

  • clojure.unchecked: Contains unchecked versions of the primitive cast functions. Removed the unchecked-prim cast functions that were added to core recently.
  • clojure.unchecked.long: Contains unchecked, long-arg versions of the numeric and bit-op functions from core.
  • clojure.unchecked.double: Contains unchecked, double-arg versions of the numeric functions from core.
Show
Alexander Taggart added a comment - - edited Rather than changing the behaviour of the extant unchecked ops (see the original discussion), I've created three new namespaces:
  • clojure.unchecked: Contains unchecked versions of the primitive cast functions. Removed the unchecked-prim cast functions that were added to core recently.
  • clojure.unchecked.long: Contains unchecked, long-arg versions of the numeric and bit-op functions from core.
  • clojure.unchecked.double: Contains unchecked, double-arg versions of the numeric functions from core.
Alexander Taggart made changes -
Field Original Value New Value
Attachment unchecked.patch [ 10173 ]
Hide
Alexander Taggart added a comment -

Note that the clojure.unchecked namespace idea was first proffered by Rich in the comments on CLJ-441.

Show
Alexander Taggart added a comment - Note that the clojure.unchecked namespace idea was first proffered by Rich in the comments on CLJ-441.
Hide
Rich Hickey added a comment - - edited

This does way too much, and thus makes it hard to talk about.

Moving unchecked coercions into unchecked ns is ok, and would make a fine and acceptably-sized patch.

unchecked double makes no sense to me at all - no double ops are checked

There seems to be general confusion about unchecked vs primitive-taking. Only a small subset of ops have the overflow checking that is turned off by 'unchecked'

There's no sense in which the interacts with *unchecked-math*, nor with the latest numerics approach (primitive semantics by default)

There's a ton of duplication with things already in Numbers that handle primitive overloads. esp. in combination with different primitives and objects.

The things we need for bit ops are lost in the noise.

What I want for bit ops is the same thing we currently (in latest) have for other ops - primitive semantics by default, no conditionals, direct mapping to JVM primitive ops.

And separate tickets and patches for each step, please. This is simply too much to consider.

Thanks,

Rich

Show
Rich Hickey added a comment - - edited This does way too much, and thus makes it hard to talk about. Moving unchecked coercions into unchecked ns is ok, and would make a fine and acceptably-sized patch. unchecked double makes no sense to me at all - no double ops are checked There seems to be general confusion about unchecked vs primitive-taking. Only a small subset of ops have the overflow checking that is turned off by 'unchecked' There's no sense in which the interacts with *unchecked-math*, nor with the latest numerics approach (primitive semantics by default) There's a ton of duplication with things already in Numbers that handle primitive overloads. esp. in combination with different primitives and objects. The things we need for bit ops are lost in the noise. What I want for bit ops is the same thing we currently (in latest) have for other ops - primitive semantics by default, no conditionals, direct mapping to JVM primitive ops. And separate tickets and patches for each step, please. This is simply too much to consider. Thanks, Rich
Alexander Taggart made changes -
Attachment unchecked.patch [ 10173 ]
Hide
Alexander Taggart added a comment -

Patch removes support for non-primitive args to bit-shift operations.

Show
Alexander Taggart added a comment - Patch removes support for non-primitive args to bit-shift operations.
Alexander Taggart made changes -
Attachment 767.patch [ 10180 ]
Alexander Taggart made changes -
Attachment 767.patch [ 10180 ]
Hide
Alexander Taggart added a comment -

Was effectively replaced by CLJ-772.

Show
Alexander Taggart added a comment - Was effectively replaced by CLJ-772.
Alexander Taggart made changes -
Status Open [ 1 ] Closed [ 6 ]
Resolution Declined [ 2 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: