kasei / perl-iri

Perl implementation of Internationalized Resource Identifiers (IRIs)
0 stars 6 forks source link

Re-enable coercions #13

Closed kjetilk closed 4 years ago

kjetilk commented 5 years ago

Currently, the coercions from Str and URI are commented out, and they are missed.

In particular, in Attean, when using URI::Namespace, I have to do

Attean::IRI->new($ns->foaf->name->as_string);

and it feels a bit ugly to explicitly go through a string for conversion between two very similar types. So, it seems like a good start to make these coercions available.

kjetilk commented 5 years ago

There is a bunch of these in Types:URI that I had forgotten about. We should look into if we should add to them, or perhaps add types to Attean.

kasei commented 5 years ago

Agreed. I've always hated the extra syntax of using the namespace objects to instantiate an IRI. I don't recall why we didn't do more with coercions in the past (and I seem to recall we did some but commented them out). I've been busy with work, but would be happy to merge a PR (re-)enabling coercions, or I can try to get to it slowly as I'm able.

kjetilk commented 4 years ago

These are now in Types::URI, so we can close this.