From: Sean O'D. <se...@ce...> - 2004-09-09 16:18:33
|
A proposal: Quotes are used as a character escape mechanism, not a typing mechanism. When scalars are loaded, they would be always just scalars and not typed to !!str simply because they're wrapped by quotes. There's an implicit typing phase where scalars are turned into !!int and other types, so why not move !!str typing to that phase? Benefit: Other types can be wrapped in quotes as a character escape mechanism and still get their true implicit type later. Example: num: "-23" This allows "-23" to be loaded as just a scalar, not a !!str, with the '-' ignored as a delimiter and the quotes removed, so the scalar value is really just -23 initially. During the implicit typing phase, the scalar gets transformed into an !!int. It seems really inconsistent to me that we have a "pre-default typing phase" where some scalars get typed as !!str and then at a later phase other types like !!int are added. I see no reason to have a middle phase where scalars are either plain scalars or strings. An application either wants default implicit typing or it doesn't, so it won't have much use for a halfway typed representation. It either wants implicit types, so it wants !!int, !!str and everything else, or it just wants the representation loaded as a graph of just !!scalars (plus !!seq and !!map). If an applications WANTS *some* typing (such as just !!str and plain scalars), then let's design a mechanism that allows applications to specify which types it wants, but let's not assume that they'll only want !!str. The pre-default typing phase seems like a real wasted effort. I say: load everything as scalar, then transform into implicit types, but don't do half the job at one phase and then the rest later. Do it all, or don't do it at all. Sean O'Dell |