raganwald-deprecated / homoiconic

An experiment in publishing code and words about code on a small scale.
http://github.com/raganwald/homoiconic/tree/master/homoiconic.markdown
Other
1.82k stars 112 forks source link

How About *easier* #24

Closed WebReflection closed 6 years ago

WebReflection commented 11 years ago

I wonder if you really need push to return the pushed value ... what's the use case and why would you need that ? ... cause things could be much easier and faster just using Array.

    function StackMaker() {
      var a = [];
      a.isEmpty = StackMaker.isEmpty;
      return a;
    }
    StackMaker.isEmpty = function () {
      return this.length < 1;
    };

What do you think ?

raganwald commented 11 years ago

You know and I know that Array already has a push method, I was just using this to demonstrate how to create a fully encapsulated data structure works, so yes for production purposes you'd go another way.