--CdrF4e02JqNVZeln
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 07, 2012 at 09:30:51AM +0900, trans (Thomas Sawyer) wrote:
>=20
> Issue #6840 has been reported by trans (Thomas Sawyer).
>=20
> ----------------------------------------
> Feature #6840: YAML tag method
> https://bugs.ruby-lang.org/issues/6840
>=20
> Author: trans (Thomas Sawyer)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category: lib
> Target version: 1.9.3
>=20
>=20
> =3Dbegin
> When loading YAML documents that have a tag, there doesn't seem to be any=
way to query for that information.
>=20
>   h =3D YAML.load("--- !foo\na: 1\nb: 2")
>   h  #=3D> {"a"=3D>1, "b"=3D>2}
>   h.what_method?  #=3D> "!foo"
>=20
> I know about `YAML.add_domian_tag` and the like, but registering tags up =
front doesn't always fit the usecase. For instance, I am working on a proje=
ct where I don't want the end users to have to use a support library to wor=
k with the data,

If you're defining custom data types (which it sounds like you are),
wouldn't you *want* users to install a support library?  You'll probably
need to update and version those custom data types (I assume people will
probably want to upgrade some day).

> and I certainly don't expect them to copy and paste dozens of lines of #a=
dd_domain_tag boilerplate to their projects. Yet the tags can be useful to =
them for type revison information, e.g.
>=20
>   --- !foo/2
>=20
> So this is the second revision of the foo type. The information could be =
important to consumer apps to ensure they handle the data properly. =20

This sounds like a complex object.  What is a "foo" type?  Who defines
the "foo" type?  If the "foo" type is the same as a built in Ruby
object, why do we need the extra methods?

> So I am proposing that Pysch add a method (maybe call it `#yaml_tag`), th=
at can be used to get this information from an object when it has been load=
ed via YAML.

I have to reject this.  I don't want to add more methods to core objects
(especially with things specific to YAML), and this problem seems like
something easily solvable by installing a gem.

--=20
Aaron Patterson
http://tenderlovemaking.com/

--CdrF4e02JqNVZeln
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Darwin)

iQEcBAEBAgAGBQJQIYZQAAoJEJUxcLy0/6/G3NYH/iTOMWjSZgrYMpMKj0k3VA4A
Ov27XfhecmuCM+FoXUeAUnbIM3oMynx1tqGBJ/ApdnXBbL7fPuM9WWuLofYJHtcL
znH8NnygHvos89cUAByi61Nb5msFc9hA5FICk1Ae2NDtaQWuyZDUXMYkER5G7a+/
aC0YevcnMZoYn5Xs6ddu1lDklqwtOA5SsmTYyOtZykImV1/JuVpl3EYP5KY8M7fl
+SeeUEEX9r56d5Pp0E8ZOvVIYjRTgGgAUq8+1w7K3+iI3/kEMhYhtb5FTWPFakmr
vd3+hTHwCAgctenvFNBgSrDUA/ax81SDi1SUTamqBVoe2JvI/ZgLgQ5pM8bNS5A=
=OdFz
-----END PGP SIGNATURE-----

--CdrF4e02JqNVZeln--

On Tue, Aug 07, 2012 at 09:30:51AM +0900, trans (Thomas Sawyer) wrote:
>=20
> Issue #6840 has been reported by trans (Thomas Sawyer).
>=20
> ----------------------------------------
> Feature #6840: YAML tag method
> https://bugs.ruby-lang.org/issues/6840
>=20
> Author: trans (Thomas Sawyer)
> Status: Open
> Priority: Normal
> Assignee:=20
> Category: lib
> Target version: 1.9.3
>=20
>=20
> =3Dbegin
> When loading YAML documents that have a tag, there doesn't seem to be any=
way to query for that information.
>=20
>   h =3D YAML.load("--- !foo\na: 1\nb: 2")
>   h  #=3D> {"a"=3D>1, "b"=3D>2}
>   h.what_method?  #=3D> "!foo"
>=20
> I know about `YAML.add_domian_tag` and the like, but registering tags up =
front doesn't always fit the usecase. For instance, I am working on a proje=
ct where I don't want the end users to have to use a support library to wor=
k with the data,

If you're defining custom data types (which it sounds like you are),
wouldn't you *want* users to install a support library?  You'll probably
need to update and version those custom data types (I assume people will
probably want to upgrade some day).

> and I certainly don't expect them to copy and paste dozens of lines of #a=
dd_domain_tag boilerplate to their projects. Yet the tags can be useful to =
them for type revison information, e.g.
>=20
>   --- !foo/2
>=20
> So this is the second revision of the foo type. The information could be =
important to consumer apps to ensure they handle the data properly. =20

This sounds like a complex object.  What is a "foo" type?  Who defines
the "foo" type?  If the "foo" type is the same as a built in Ruby
object, why do we need the extra methods?

> So I am proposing that Pysch add a method (maybe call it `#yaml_tag`), th=
at can be used to get this information from an object when it has been load=
ed via YAML.

I have to reject this.  I don't want to add more methods to core objects
(especially with things specific to YAML), and this problem seems like
something easily solvable by installing a gem.

--=20
Aaron Patterson
http://tenderlovemaking.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Darwin)

iQEcBAEBAgAGBQJQIYZQAAoJEJUxcLy0/6/G3NYH/iTOMWjSZgrYMpMKj0k3VA4A
Ov27XfhecmuCM+FoXUeAUnbIM3oMynx1tqGBJ/ApdnXBbL7fPuM9WWuLofYJHtcL
znH8NnygHvos89cUAByi61Nb5msFc9hA5FICk1Ae2NDtaQWuyZDUXMYkER5G7a+/
aC0YevcnMZoYn5Xs6ddu1lDklqwtOA5SsmTYyOtZykImV1/JuVpl3EYP5KY8M7fl
+SeeUEEX9r56d5Pp0E8ZOvVIYjRTgGgAUq8+1w7K3+iI3/kEMhYhtb5FTWPFakmr
vd3+hTHwCAgctenvFNBgSrDUA/ax81SDi1SUTamqBVoe2JvI/ZgLgQ5pM8bNS5A=
=OdFz
-----END PGP SIGNATURE-----