Giter VIP home page Giter VIP logo

Comments (4)

burke avatar burke commented on June 25, 2024

http://github.com/evanphx/rubinius/blob/65944505d2f2a34d29944d27457a0479cbf0ffb0/lib/compiler/ast/literals.rb#L289

  # We also do not handle any case where #to_s does not actually return a
  # String instance.

So yes, it seems that it's intentional.

from rubinius.

burke avatar burke commented on June 25, 2024

Umm, just realized you wrote the comment I quoted. So uhh.. yeah.

from rubinius.

evanphx avatar evanphx commented on June 25, 2024

This is particularly hairy because we call #to_s in the bytecode, so by the time the string construction starts, we've lost the object we called #to_s on to use the fallback.

We'd have to call out to a helper that calls #to_s and checks the return value. Thats expensive since this almost never happens anyway.

I wonder if I shouldn't just take the value, and if it's not a string, return it as one. So in your example case, the value would be "1", since we'd render the 1.

Perhaps I'll just do that.

from rubinius.

evanphx avatar evanphx commented on June 25, 2024

Use a fallback conversion in string_build. Closed by 33daa62.

from rubinius.

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.