Skip to content

Reconsider value parsing of std/ini #5614

Open

Description

@kt3k

Currently the parser parses all values into string, but the existing parsers in the ecosystem often work in a different way.

  • npm:ini
    • parses true false into booleans
    • no handling for numbers
    • strips double quotes when they are balanced. (no stripping happens if quotes are not balanced)
    • also supports array in the form of array[] = value
  • python configparser std module
    • parses all values into string by default
    • optionally you can call getboolean to covert value into boolean (many things are considered boolean such as true/false, yes/no, on/off, 1/0)
    • no quote stripping
  • parse_ini_string builtin function in php
    • handles TRUE FALSE as booleans
    • strips quotes around the value. Errors at unbalanced quotes.

(Further investigations of other parsers are welcome)

There seem no consensus in value handling, it might make sense to follow npm:ini when there's differences.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions