Coder Social home page Coder Social logo

Mixin examples are wrong about middleclass HOT 4 CLOSED

mebens avatar mebens commented on August 22, 2024
Mixin examples are wrong

from middleclass.

Comments (4)

kikito avatar kikito commented on August 22, 2024

Thanks for reporting this. I've fixed the wiki (btw, I thought anyone could make fixes on the wiki - isn't that how wikis work?)

The last function was a class method, so it's signature didn't need "self" (class was self on this case). I've however renamed "class" to "theClass" so it follows my own naming conventions.

Regards!

from middleclass.

mebens avatar mebens commented on August 22, 2024

I didn't want to edit without your permission, even though some of the errors were very obvious.

About the last function, I would expect it to work that way, but I don't think it does. Take a look at this from middleclass-extras' Indexable:

function Indexable:included(theClass) 

As you know, that's translated to:

function Indexable.included(self, theClass)

I've also tried using the included function without self, but it doesn't work. The second argument "theClass" is always the class in my usage.

from middleclass.

kikito avatar kikito commented on August 22, 2024

For the record: you (or anyone else interested in helping me out with my doc) have my explicit permission to correct the wiki. Specially the obvious errors.

Regarding your comment about included - you are again right. I now remember changing it some time ago - there is an edge case on which it might be usefult to have that extra self reference. It's just so "edge" that I tend to forget about it.

So yes, it should be :included(theClass), not .included(theClass). You were absolutely right, thanks for your insight, and sorry about the confusion.

I've changed the mixin wiki page (again) in order to reflect this.

from middleclass.

mebens avatar mebens commented on August 22, 2024

Alright, I'll remember that.

Yeah it does appear to be an "edge" case, because the mixin itself could be referred to by it's name as well.

No worries. :)

from middleclass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.