From: Leslie Viljoen Date: 2006-08-23T00:15:49+09:00 Subject: Re: Static typing ain't so bad, after all... On 8/22/06, Just Another Victim of the Ambient Morality wrote: > ...but this is often not enough. What if the parameter is called > "node." In context, how can this be better? "parse_node?" > "html_parse_node?" What's in this "html_parse_node?" Is it lazy parsing > or did it do the processing as it parsed and the node contains the parsed, > processed data? How would I know this? I can't look up any of the objects > that will be passed in because any object can be passed in; this language > is dynamically typed! I could look for a "class Node" in the hopes that > that is the name of one of the object classes passed in but who knows? It > could be called anything and there's no way for me to know what that > anything is! > If the language were statically typed, I would know straight away what > type the parameter was and can look up, exactly, what it does and can > probably easily discern what it's role is. I have on occasion solved this problem by putting "breakpoint" as the first line of the method and then inspecting the object that was received in a debug console. Of course that doesn't always work or can't always be done, but it has been useful. Something else that bothers me is that sometimes code raises exceptions, sometimes it returns nil, and when programming I often can't decide which is better. When I go with the 'nil' approach I find myself hunting for where the object became 'nil', often several methods back. Anyone have any guidelines on this? Les