I know that there are ten different alternatives. Why don’t we simply improve the basic stuff?

  • Ephera
    link
    fedilink
    arrow-up
    16
    ·
    8 months ago

    Yeah, for this reason, lots of full-fledged programming languages actually make you specify the arguments as a list of strings directly, so for example:

    Command::new("cp")
        .args(["file 1", "file 2”])
    
    • OpenStars@discuss.online
      link
      fedilink
      English
      arrow-up
      17
      ·
      8 months ago

      It’s a subset of the standard delimiter problem: if I want to use the delimiter inside of an entry, can I even do that and if so then how?

      e.g. in comma-delimited lists you could “escape” the commas individually, or encapsulate each entry inside quotes, or provide each entry by name, etc. - all of which significantly complicates the retrieval process by adding greater complexity to decide on rules determining how it all works (like if by name, then what if the user [stupidly? on purpose?] provides multiple entries with the same name - do subsequent ones overwrite the earlier ones or their contents get appended to the end and if the latter, is any separation provided between them? and on and on it goes):

      • item1,item2,item3
      • “Denver, CO”,“New York, NY”,Miami/, FL
      • “Lastname, Firstname”,Lastname/, Firstname
      • item1=“Denver, CO”, item2=“New York, NY”

      Common English has issues with this too like is a list with “John, Marsha, Barbie and Ken” 4 entries or just 3 where the latter is a pairing? (leading to Oxford comma discussion:-P it is very important though bc while while individual people may have similar needs like food, pairings may have different constraints like if they drive together then they need less parking space)

      So this delimiter issue is not even specific to CLIs, nor even computers in general - it is a universal problem with any communication system.