Re: Force a value:pair assignment to be string?

"Clark C. Evans" <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Kenneth,

short answer:
  You should be able quote those Y/N items to force them 
  to be a string.

long answer:
  You might be able to configure your parser to not "implicitly
  type" Y/N as a boolean value.  

longest answer: >
  You've hit the #1 usability prooblem with YAML, it's called "implicit
  type resolution" and different implementations are doing it
  differently.  
  
  The original goal was to make it easy to type in integers and have
  them show up as integers w/o littering your text with "!!int".
  Unfortuntely, where that line should be drawn is a bit hard.

  In the next pass of YAML, I am going to recommend that all parsers
  _only_ do implicit typing on:
  
    (a) symbolic values, such as <<, which can be used to 
        augment the YAML syntax /w very nice hooks
        
    (b) numbers, "true" "false" and "null", following
        the JSON standard (for compatibility)

  At least, this should, IMHO, be the default.  I think Ingy begs
  to differ and believes the default should be *all strings* with
  no implicit typing.  What ever we come up with, getting there 
  is sure to be unpleasent; but probably far less unpleasant than
  the current state of affairs.

Cheers,

Clark



On Tue, Apr 17, 2007 at 10:59:16AM -0400, Kenneth Downs wrote:
| Hello!
| 
| I am a recent convert to YAML, using spyc to load YAML files to PHP 
| arrays.  Very very nice.
| 
| There are many places where we have assignment pairs that look like 
| "primary_key: Y" or "uisearch: Y", and YAML is interpreting these to be 
| booleans and making them into 1/0 assignments.
| 
| It seems that with TAGs I ought to be able to force those particular 
| keys to read as strings.  But alas, the documentation, while very 
| complete, is also very abstract and lacks (as far as I could find) an 
| example of this basic task.  Can anybody clue me in?
| 
| Thanks.
| 
| -- 
| Kenneth Downs
| Secure Data Software, Inc.
| www.secdat.com    www.andromeda-project.org
| 631-379-7200   Fax: 631-689-0527
| 
| 
| -------------------------------------------------------------------------
| This SF.net email is sponsored by DB2 Express
| Download DB2 Express C - the FREE version of DB2 express and take
| control of your XML. No limits. Just data. Click to get it now.
| http://sourceforge.net/powerbar/db2/
| _______________________________________________
| Yaml-core mailing list
| [email protected]
| https://lists.sourceforge.net/lists/listinfo/yaml-core

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.