News for hackers. Stuff that matters.
Re:Parsing can become accidentally quadratic because of sscanf by sdenton4 on Monday March 01, 2021 @11:24AM (#26304358)
(As opposed to the comma-separated data files that we enlightened future-folk use!)
Re:Parsing can become accidentally quadratic because of sscanf by Darkphibre on Monday March 01, 2021 @12:09PM (#26305052)
You know, why don't we use 0x1F (Unit Separator)? Seems like we have had a hierarchical delimiters since ASCII / punch cards, yet I never hear about them. https://en.wikipedia.org/wiki/C0_and_C1_control_codes#Field_...

CSVs are such a pain if you have freeform text (in which you have to handle newlines and escaped quotes).

It seems like using FS/GS/RS/US from the C0 control codes would be divine (provided there was implicit support for viewing/editing them in a simple text editor). I get that it's a non-printable control character, and thus not traditionally rendered... but that latter point could have been done ages ago as a standard convention in editors (enter VIM et. al., as they will indeed allow you to see them).

Re:Parsing can become accidentally quadratic because of sscanf by jimmaswell on Monday March 01, 2021 @12:17PM (#26305195)
It's nice being able to edit a CSV in a text editor. It wouldn't be worth it to lose that just to not have to escape some strings.
Re:Parsing can become accidentally quadratic because of sscanf by JdeBP on Monday March 01, 2021 @01:47PM (#26306507)
Text editors that can put control characters into files, and indeed PC keyboards that have a [Control] key, have been around for decades, though. For example: With WordStar, SideKick, and Microsoft's EDIT, one just typed [Control]+[P] and then the control character. M. Darkphibre mentioned VIM, but really this isn't an idea that was ever limited to just VIM and emacs.
Re:Parsing can become accidentally quadratic because of sscanf by sp332 on Monday March 01, 2021 @01:42PM (#26306403)
It wouldn't take that much effort to add a glyph in the editor for it?
Re:Parsing can become accidentally quadratic because of sscanf by afiori on Monday March 01, 2021 @12:46PM (#26305610)
more than that it is nice to edit files with a standard keyboard,
Re:Parsing can become accidentally quadratic because of sscanf by db48x on Monday March 01, 2021 @05:16PM (#26309210)
If your editor doesn't allow you to enter arbitrary characters using a standard keyboard then you need a better editor.
Re:Parsing can become accidentally quadratic because of sscanf by chousuke on Monday March 01, 2021 @06:00PM (#26309696)
The problem is not the editor, it's the human typing on the keyboard that sees , and thinks "that'll do". Using an obscure dedicated character is not going to happen.
Re:Parsing can become accidentally quadratic because of sscanf by Darkphibre on Wednesday March 03, 2021 @03:53AM (#26326127)
I guess my point was a curiosity that these control codes had become obscure, when text format interchange is so prevalent throughout computing history.
Re:Parsing can become accidentally quadratic because of sscanf by afiori on Tuesday March 02, 2021 @12:56AM (#26312293)
I do not want to learn new input methods for every program, I want a standardized compose-like functionality that allow me to write both diacritics and backticks ( a plus for the rest of unicode)
Re:Parsing can become accidentally quadratic because of sscanf by db48x on Tuesday March 02, 2021 @02:36AM (#26312809)
All operating systems have that too. Look up "Input Method Editor" in your favorite OS's documentation. See also dead keys, compose key, AltGr, etc, etc. If you think you can't edit a file because it has funny characters in it, then you're not trying hard enough.
Re:Parsing can become accidentally quadratic because of sscanf by afiori on Tuesday March 02, 2021 @02:50AM (#26312909)
I know, still there is no reasonable way* to do both common european diacritics and backticks/tilde on windows without installing third-party software.

* I find dead keys irritating beyond reason, so I do not count them as an option

Re:Parsing can become accidentally quadratic because of sscanf by 0xbadcafebee on Monday March 01, 2021 @12:39PM (#26305517)
There are plenty of ways a lazy programmer will want to pass the records into something else that either doesn't handle non-printables, or does but the user doesn't like how it looks.

TSV also works more reliably than CSV, because most people don't put tab characters in the data in these kinds of records. Tab is even the default field delimiter for cut. But everybody uses CSV, because again it's easier to reason about the above. (shrug)

Re:Parsing can become accidentally quadratic because of sscanf by nitrogen on Monday March 01, 2021 @03:56PM (#26308292)
No matter what delimiters we use, we still have either a data sanitization problem or a data escaping problem. I've worked with a wire protocol that used the ASCII record delimiters, but with binary data so you also had to use binary escape (0x1b) and set the eighth bit on the following byte.
Re:Parsing can become accidentally quadratic because of sscanf by elygre on Monday March 01, 2021 @02:15PM (#26306890)
Which is a mess, because some parts of the world use commas as decimal commas: 3,14159etc. So we have to use semicolon for our CSVs.
Re:Parsing can become accidentally quadratic because of sscanf by bmn__ on Monday March 01, 2021 @03:46PM (#26308163)
> some parts of the world

most parts

Why can't you be normal? https://commons.wikimedia.org/wiki/File:DecimalSeparator.svg

Re:Parsing can become accidentally quadratic because of sscanf by dmit on Monday March 01, 2021 @06:08PM (#26309765)
I submitted a patch to support decimal commas when parsing timestamps in Go in 2013. I thought this was a slam dunk because while major users of decimal dots include USA, China, India, and Japan, the decimal comma is used by pretty much every other country in the world. Going from ~40% support to ~99.9% support seemed like an obvious win.

Rob Pike politely declined the patch, commenting "I might prefer to leave it unaddressed for the moment. Proper locale treatment is coming (I hope soon) and this seems like the wrong place to start insinuating special locale handling into the standard library."

Three years later another Go team member commented that "Date localization is definitely still in the planning."

We're in year 8 now. The issue is still open. Rob Pike is still hoping.

Re:Parsing can become accidentally quadratic because of sscanf by boogies on Monday March 01, 2021 @07:12PM (#26310307)
> ~40% support to ~99.9% support

№ of countries ≠ № of people though. ⅘ of the 5 most populous countries¹ use decimal points, and together they alone² have ~42½% of the world’s people. Do all decimal point countries together have ≤50%? (Edit: Is it really not “normal” to do things the Anglophone way?)

¹According to https://en.wikipedia.org/wiki/List_of_countries_and_dependen...

²Not counting territories

Re:Parsing can become accidentally quadratic because of sscanf by nicoburns on Monday March 01, 2021 @06:58PM (#26310201)
This is where Rust's decision to keep such functions out of the standard library entirely starts to look pretty smart.
Re:Parsing can become accidentally quadratic because of sscanf by tyg13 on Monday March 01, 2021 @11:30PM (#26311915)
Wow, taking a look at the related issues, they are really hostile towards fixing this particular pain point. I knew Go had a reputation for being condescending and opinionated, but I had no idea it was this bad.

https://github.com/golang/go/issues/6189

https://github.com/golang/go/issues/26002

https://github.com/golang/go/issues/27746

https://github.com/golang/go/issues/36145

Re:Parsing can become accidentally quadratic because of sscanf by fomine3 on Monday March 01, 2021 @07:21PM (#26310375)