Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting programs in dynamic languages that go beyond what the specification allows
    primarykey
    data
    text
    <p>With the growth of dynamically typed languages, as they give us more flexibility, there is the very likely probability that people will write programs that go beyond what the specification allows.</p> <p>My thinking was influenced by this question, when I read the answer by bobince: <a href="https://stackoverflow.com/questions/1777705/a-question-about-javascripts-slice-and-splice-methods/1777773#1777773">A question about JavaScript&#39;s slice and splice methods</a></p> <p>The basic thought is that <code>splice</code>, in Javascript, is specified to be used in only certain situations, but, it can be used in others, and there is nothing that the language can do to stop it, as the language is designed to be extremely flexible.</p> <p>Unless someone reads through the specification, and decides to adhere to it, I am fairly certain that there are many such violations occuring.</p> <p>Is this a problem, or a natural extension of writing such flexible languages? Or should we expect tools like JSLint to help be the specification police?</p> <p>I liked one answer in this question, that the implementation of python is the specification. I am curious if that is actually closer to the truth for these types of languages, that basically, if the language allows you to do something then it is in the specification. <a href="https://stackoverflow.com/questions/1094961/is-there-a-python-language-specification">Is there a Python language specification?</a></p> <p>UPDATE:</p> <p>After reading a couple of comments, I thought I would check the splice method in the spec and this is what I found, at the bottom of pg 104, <a href="http://www.mozilla.org/js/language/E262-3.pdf" rel="nofollow noreferrer">http://www.mozilla.org/js/language/E262-3.pdf</a>, so it appears that I can use splice on the array of children without violating the spec. I just don't want people to get bogged down in my example, but hopefully to consider the question.</p> <pre><code> The splice function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the splice function can be applied successfully to a host object is implementation-dependent. </code></pre> <p><strong>UPDATE 2:</strong> I am not interested in this being about javascript, but language flexibility and specs. For example, I expect that the Java spec specifies you can't put code into an interface, but using AspectJ I do that frequently. This is probably a violation, but the writers didn't predict AOP and the tool was flexible enough to be bent for this use, just as the JVM is also flexible enough for Scala and Clojure.</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.
    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