Note that there are some explanatory texts on larger screens.

plurals
  1. POSimulating aspects of static-typing in a duck-typed language
    primarykey
    data
    text
    <p>In my current job I'm building a suite of Perl scripts that depend heavily on objects. (using Perl's <code>bless()</code> on a Hash to get as close to OO as possible) </p> <p>Now, for lack of a better way of putting this, most programmers at my company aren't very smart. Worse, they don't like reading documentation and seem to have a problem understanding other people's code. Cowboy coding is the game here. Whenever they encounter a problem and try to fix it, they come up with a horrendous solution that actually solves nothing and usually makes it worse.</p> <p>This results in me, frankly, not trusting them with code written in duck typed language. As an example, I see too many problems with them not getting an explicit error for misusing objects. For instance, if type <code>A</code> has member <code>foo</code>, and they do something like, <code>instance-&gt;goo</code>, they aren't going to see the problem immediately. It will return a null/undefined value, and they will probably waste an hour finding the cause. Then end up changing something else because they didn't properly identify the original problem.</p> <p>So I'm brainstorming for a way to keep my scripting language (its rapid development is an advantage) but give an explicit error message when an object isn't used properly. I realize that since there isn't a compile stage or static typing, the error will have to be at run time. I'm fine with this, so long as the user gets a very explicit notice saying "this object doesn't have X"</p> <p>As part of my solution, I don't want it to be required that they check if a method/variable exists before trying to use it. </p> <p>Even though my work is in Perl, I think this can be language agnostic. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload