-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null ref #11
Conversation
Two refs
This is clear, two refs are two separate objects.
I suppose one could argue for this being true and implementing it in |
classes/JSONlib.sc
Outdated
@@ -31,7 +28,7 @@ JSONlib { | |||
var array; | |||
^case | |||
{ v.isKindOf(Symbol) } { this.prConvertToJson(v.asString) } | |||
{ v == "null" or: { v.class == JSONlibNull } or: { v == nil } } { "null" } | |||
{ v == "null" or: { v.value == nil } or: { v == nil } } { "null" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should check for Ref
class. Otherwise, you may lose a function like { |x| x !? (x+1) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and it is confusing that we use the null
string. Let's do two things only:
{ v.isNil or: { v.class == Ref and: { v.value.isNil } } }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point - can you check if it is better now?
classes/JSONlib.sc
Outdated
@@ -28,7 +28,8 @@ JSONlib { | |||
var array; | |||
^case | |||
{ v.isKindOf(Symbol) } { this.prConvertToJson(v.asString) } | |||
{ v == "null" or: { v.value == nil } or: { v == nil } } { "null" } | |||
// only check value if it is a ref | |||
{ (v.isKindOf(Ref)).if({v.value==nil}, {false}) or: { v == nil } } { "null" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please instead of
{ (v.isKindOf(Ref)).if({v.value==nil}, {false}) or: { v == nil } } { "null" }
make it
{ v.isNil or: { v.isKindOf(Ref) and: { v.value.isNil } } } { "null" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imlpemented
Closes #7 and closes #5
BTW, why is