Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Avernar
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
61.
▲
by
Avernar
9y ago
Thanks. I'm glad some people are getting some use from my posts. I'm used to the "religious" attacks against me as this isn't the first time it's happened. You need to have a thick skin to post the non-mainst
62.
▲
by
Avernar
9y ago
>> if it was smart it would have figured out that the value never was initialized > But that's false Are you reading the same code the rest of us are? NeverCalled is never called. So Do is not explicitly initialized and ther
63.
▲
by
Avernar
9y ago
> It's really nice to be able to use abstractions that cost nothing because the compiler is smart. But the compiler is not smart. It's screwing up in certain cases. In this example if it was smart it would have figured out th
64.
▲
by
Avernar
9y ago
Safari is full of bugs and incompatibilities. Every time I develop something for the web it's always "works on Firefox, works on Chrome, works on IE/Edge and works on... Nope! Something broke on safari again." And the
65.
▲
by
Avernar
9y ago
Ah, I see. I agree that it would be a bad idea to give acess to the UTF-8 representstion. As for length in bytes, a good way to handle most use cases regarding that is to have a function that truncates the string to fit into a certain numb
66.
▲
by
Avernar
9y ago
Change case, yes, that would require actually decoding the string to the unicode type. But that could be done when needed and not every time something from my databse needs to go out to the client. Slicing works fine on a UTF-8 string as I
67.
▲
by
Avernar
9y ago
But that's the same for UTF-16 and UTF-32. That's why I was wondering why you singled UTF-8 out, implying it needed extra handling.
68.
▲
by
Avernar
9y ago
That's why the search functions need to be more intelegent. If you pass the search function a grapheme it will do more work. If it notices you just passed in a grapheme that's just a code point it can do a code point scan. And
69.
▲
by
Avernar
9y ago
I'm not advocating that the programmer needs to implement the iterators but that the language/runtime have built in support for them. As for searching for ASCII, which is prevalent in parsing, the iterator function to find the nex
70.
▲
by
Avernar
9y ago
When you get multiple devices that require the same inbound ports (game consoles are a good example) you can open the same port for each device.
71.
▲
by
Avernar
9y ago
But you can open a large range of ports to multiple devices. For a game console you can allow UDP 1024-65535 without issue. And if you have multiple devices that use the same port you can open that port on each one. No need for an externa
72.
▲
by
Avernar
9y ago
You might be correct and 32 bits could have been enough but Unicode has restricted code points to 21 bits. Why? Because of stupid UTF-16 and surrogate pairs. I'm curious why you think that UTF-8 requires complicated lookup tables.
73.
▲
by
Avernar
9y ago
Semantically equivalent yes, access time equivalent for variable width strings no. One of the reasons for Python 3's odd internal string format is because they wanted to keep indexing and have indexing be O(1). The reason why I think
74.
▲
by
Avernar
9y ago
If the string is stored as ASCII characters or Unicode code points (UCS-16 or UCS-32) then you are correct that not much changes. But if the string is in UTF-8, UTF-16 or the string system uses graphemes then indexing goes from O(1) to O(N
75.
▲
by
Avernar
9y ago
It didn't have emoji but it did have other combining characters. While some langages it's feasable to normalize them to single code points but other langagues it would not be. Plus the fact that some visible characters are made u
76.
▲
by
Avernar
9y ago
I don't see why this would be hard with iterators. You have an iterstor to the start of the HICN, either at the start of a or deep in the string. Take a second iterator and set it to the first. Loop six times advancing that iterator
77.
▲
by
Avernar
9y ago
I didn't realize the modulo operator for bytes was added. most information I've run across said it didn't work. Unfortunately most libraries for 3 will be using str so using bytes with UTF-8 inside will become more and more
78.
▲
by
Avernar
9y ago
Look back a few posts. We're discussing using UTF-8 in str and avoiding the unicode type in Python 2. I'n my use case I validate the string as UTF-8 from the internet. To and from the database is UTF-8 so no validation is requir
79.
▲
by
Avernar
9y ago
> I definitely need indexes No you don't. You need iterators, which behave like pointers. Let's say you're hundreds or thousands of characters into a string at the start of some token. Now you want to scan from that pos
80.
▲
by
Avernar
9y ago
> But when you get right down to it, what I do for a living is write web applications, That is my use case for Python as well. > sometimes I have to write validation that cares about length, That's where a trucation function that
81.
▲
by
Avernar
9y ago
All Python 3 did was put a hard barrier between bytes and strings. That's it. Mising is all the grapheme handling that languages that do Unicode strings right have.
82.
▲
by
Avernar
9y ago
> Since the high-level API is supposed to let you treat a string as a sequence of code points, I disagree with that premise. It should operate on grapheme clusters. Operating on code points falls into the same trap as operating on byte
83.
▲
by
Avernar
9y ago
> This only works if every library that you use agrees with you on this, and treats all strings you pass to it as UTF-8 whenever encoding matters. Not exactly. The library just has to treat it as a string and not worry about the encodin
84.
▲
by
Avernar
9y ago
What do you mean by "expose UTF-8"? Because nothing about UTF-8 requires that you give byte access to the string. As for indexing, strings shouldn't require indexing period. That's the ASCII way of thinking, especially
85.
▲
by
Avernar
9y ago
One reason is because it would take a lot more code points to describe all the possible combinations. Take the country flag emoji. They're actually two seperate code points. The 26 code points used are just special country code lette
86.
▲
by
Avernar
9y ago
> I think UTF-8 is generally the wrong way to expose Unicode to a programmer, since it lets them think they can keep that cherished "one byte == one character" assumption right up until something breaks at 2AM on a weekend. The
87.
▲
by
Avernar
9y ago
I'm not a fan of how Python 3 stores Unicode strings internally. In my opinion they should have went with UTF-8. The extra scanning and conversion puts more preassure on the processor and caches under load. I agree that Python 2'
88.
▲
by
Avernar
9y ago
I don't see an issue with extension headers in IPv6. The RFCs have rules on who should look at what header and what to do when an unrecognized one is encountered. Most firewalls I've dealt with have some option to defragment the
89.
▲
by
Avernar
9y ago
"Switch Took More Than 300 Years" I sure hope the complete switchover from IPv4 to IPv6 also doesn't end up taking that long.
90.
▲
by
Avernar
9y ago
> Please point me to a definition of a "real layer 3 switch." All definitions of layer 3 switch I've found were stuff like this: https://en.wikipedia.org/wiki/LAN_switching#Layer_3_switchin... Those d
More ›