Code Monkey home page Code Monkey logo

Comments (4)

sporkmonger avatar sporkmonger commented on June 16, 2024

OK everyone, we're going to take a poll on this one. This would be a huge breaking change. I've got tons of code that relies on this behavior, and while you obviously disagree, I strongly prefer the current behavior. Basically, unless the whole community jumps on this issue and tells me I'm wrong (very possible, I'm often wrong), then this issue will be closed. Also, if anybody prefers the current behavior, it's probably worth mentioning it or we'll have crazy selection bias. :-P

from addressable.

nyarly avatar nyarly commented on June 16, 2024

I'm just at a loss to understand it. It looks like a special-case ::new - so it makes sense to return an object of class Addressable::URI or fail.

The fix for broken code is easy: URI::parse(var) rescue nil

The benefit is that if var happens to be nil, you have powerful flow control built in, as well as strong error conditions at the site of misuse.

from addressable.

nyarly avatar nyarly commented on June 16, 2024

Also, Addressable is described as a replacement for std-lib URI.

URI(nil) #=> raise URI::InvalidURIError: bad URI

from addressable.

sporkmonger avatar sporkmonger commented on June 16, 2024

Addressable is not a perfect drop-in replacement. It usually works as one, but there are plenty of edge cases where it won't work as such. This is a feature, not a bug, because the standard library is downright wrong on its handling of quite a few things.

Haven't seen anyone else jumping in on this issue, and since this is the first time it's come up, I'm going to go ahead and close this.

If someone had raised this issue two years ago, I might've made the change, but I'm not going to consider it right now. Maybe when Addressable hits 3.x.

from addressable.

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.