J
John Pritchard-williams
Again...just wondering....(and you can probably tell I'm comparing Ruby
with Java/C here again, following on from the "++" discussion...)
def MyObject
def my_method(obj)
if obj.class!=String then raise "Wrong Type!"
end
...stuff...
end
end
Would it cause problems with the general syntax to include some sugar to
rewrite this as:
...
def my_method(String obj)
end
...
Or is there any quick easy meta-programming to label methods as
expecting certain types?
Or am I being a big-baby wanting this kind of check, and I should get on
with the Dynamic Vibe of Ruby ?
(I just noticed that sometimes I get lost in my own programs by not
checking types thoroughly; yet Java would have forced me to stop and
think...)
John
with Java/C here again, following on from the "++" discussion...)
def MyObject
def my_method(obj)
if obj.class!=String then raise "Wrong Type!"
end
...stuff...
end
end
Would it cause problems with the general syntax to include some sugar to
rewrite this as:
...
def my_method(String obj)
end
...
Or is there any quick easy meta-programming to label methods as
expecting certain types?
Or am I being a big-baby wanting this kind of check, and I should get on
with the Dynamic Vibe of Ruby ?
(I just noticed that sometimes I get lost in my own programs by not
checking types thoroughly; yet Java would have forced me to stop and
think...)
John