Code Monkey home page Code Monkey logo

Comments (7)

DAddYE avatar DAddYE commented on May 27, 2024

100% with you!

from luna.

DAddYE avatar DAddYE commented on May 27, 2024

I prefer also the explicit-expand version:

a, b = *[1, 2]

so this:

a, b = [1, 2] will throw an error since every time I'm scared about:

a, b = c where c is an array, but how know?

So a, b = *c give me a more sense that the code is 'right'

from luna.

tj avatar tj commented on May 27, 2024

haha yeah I dont like all the flexibility ruby gives you there, all this crazy shit you have to parse out in your mind, for such little gain, but I would like to consider it for multiple return values. however even that has limited use, returning meaningful structs is better design. Even in js-land like returning [x, y] for a point and accessing [1] has no meaning vs .y etc, so it's kinda tempting to forget about this as well and keep things simple

from luna.

DAddYE avatar DAddYE commented on May 27, 2024

Yep, I see what you mean and I agree!

from luna.

tj avatar tj commented on May 27, 2024

sorry I guess it would be x, y = somethingThatReturnsAPoint(), but meh haha, pretty minimal win over p = something... I'm pretty jaded when it comes to simplicity, if it doesn't give you a major win I dont consider it much of a win at all. Ruby has tons of subtle conveniences but overall when I look at Ruby I just see a mess because hell you can define an array in like 16 ways with those weird % delimiter combo things etc

from luna.

vendethiel avatar vendethiel commented on May 27, 2024

What about destructuring then ? [a, b] = somethingThatReturnsAList()

from luna.

tj avatar tj commented on May 27, 2024

@Nami-Doc same thing really, I dont love nor hate it, im pretty impartial, so it's probably not worth complicating implementations. A limited subset might be fine, we'll see! It may be interesting from a pattern matching perspective in the future, the assignment portion I find a little boring

from luna.

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.