Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You could write 1:.

So separate wildcards and literals, each prepended by length? That would be far, far less readable than using escape sequences.

> The point is to not use XML, because it has escape characters. You could replace it with ASN.1 BER

Fair enough, but most people would consider that a solution worse than the problem.

> The IDE could update the length automatically

Making you completely dependent on an IDE to support whatever format you're editing, including nesting. You can't even read your code now without an IDE. Making up some kind of DSL on the fly? Start counting string lengths again.

Sorry, but no. Escape sequences are bad, this would so much worse.



>So separate wildcards and literals, each prepended by length? That would be far, far less readable than using escape sequences.

Wildcards do not need a prefix, when they always are a single character.

Here is a ordinary regex for a path:

    C:\\foo\\bar\\.*\.txt
And here the regex in C:

    "C:\\\\foo\\\\bar\\\\.*\\.txt"

But with lengths in a hypothetical syntax:

    11:C:\foo\bar\.*4:.txt


    22:11:C:\foo\bar\.*4:.txt
That is quite readable

> You can't even read your code now without an IDE. Making up some kind of DSL on the fly? Start counting string lengths again.

I like binary formats. The lengths are easy to see in a hex editor. 16 bytes in each line or something

You always depend on an IDE to decode the file. You could not read an UTF-8 file, if it would not decode the UTF-8 characters and show individual bytes. Or read ASCII if it were showing individual bits.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: