<< Back to previous view

[CLJ-441] Add unchecked coercions Created: 28/Sep/10  Updated: 08/Dec/10  Resolved: 26/Nov/10

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: None
Fix Version/s: Release 1.3

Type: Enhancement Priority: Blocker
Reporter: Assembla Importer Assignee: Rich Hickey
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0441-unchecked-coercions.patch    
Patch: Code and Test
Approval: Ok

 Description   

Checking in coercions has been added, making them safe, but removing the bit-twiddling power. We need some unchecked (truncating) coercion ops



 Comments   
Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

Converted from http://www.assembla.com/spaces/clojure/tickets/441
Attachments:
unchecked-casts.diff - https://www.assembla.com/spaces/clojure/documents/dVK0q-Znmr37hgeJe5cbLA/download/dVK0q-Znmr37hgeJe5cbLA
unchecked-casts-without-typo.diff - https://www.assembla.com/spaces/clojure/documents/alGr58Znur34SreJe5cbCb/download/alGr58Znur34SreJe5cbCb
0441-unchecked-coercions-plus-table.patch - https://www.assembla.com/spaces/clojure/documents/c1gyXG1xKr37lweJe5cbLr/download/c1gyXG1xKr37lweJe5cbLr

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

richhickey said: See also #284 which will be addressed by this

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

ataggart said: [file:dVK0q-Znmr37hgeJe5cbLA]: implementation and tests for unchecked casts

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

ataggart said: Added unchecked casts from every numeric primitive and Object to every numeric primitive. Character and char can only get cast to int, as per the convention with the checked cast.

Added tests for the above in clojure.test-clojure.numbers.

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

ataggart said: [file:alGr58Znur34SreJe5cbCb]: Same as above but without the typo in the docs

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

stu said: [file:c1gyXG1xKr37lweJe5cbLr]

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

stu said: Third patch subsumes previous two and adds a test table for various conversions.

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

richhickey said: I'd be interested in better names than unchecked-*

any ideas? Think also about unchecked-add et al

Comment by Assembla Importer [ 30/Sep/10 11:42 PM ]

richhickey said: let's create a clojure.unchecked ns and put these and the other unchecked arithmetic ops in there, using same names as normal, e.g. , inc etc. Only put the long versions in there, we'll have to decide separately about the truncating int-add etc. Then people can either use unchecked or alias and do uc/ etc

Comment by Rich Hickey [ 29/Oct/10 6:58 AM ]

Let's create a clojure.unchecked ns and put these and the other unchecked arithmetic ops in there, using same names as normal, e.g. +, inc etc. Only put the -long versions in there, we'll have to decide separately about the truncating int-add etc. Then people can either use unchecked or alias and do uc/+ etc

Comment by Rich Hickey [ 25/Nov/10 8:50 AM ]

error: patch failed: test/clojure/test_clojure/numbers.clj:31

Comment by Aaron Bedra [ 26/Nov/10 12:44 PM ]

Fixed up the patch to merge properly as of 8225407032ea643cbe3db7f35ef97b1230fc65b8

Generated at Sat Dec 20 17:06:39 CST 2014 using JIRA 4.4#649-r158309.