Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Declined
-
Affects Version/s: Release 1.2, Release 1.3
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Approval:Not Approved
Description
Specify a record with a field as say ^String, but the constructor won't throw if you pass in a non-String.
Activity
Timothy Baldridge
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Declined [ 2 ] | |
| Approval | Not Approved [ 10008 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Stuart Halloway
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
I doubt there's any desire to change this. Records only support typehints to enable performant storage of primitive types like ints, not to provide static typing in general. An Object is stored the same way as a String, so there's no need to pay attention to that typehint.
Functions behave the same way: ((fn [^String x] x) :test) works just fine. Only if you use a member method of the hinted type (such as .substring in this example) is an exception thrown then the compiler casts to String in order to call the method.