« first day (374 days earlier)      last day (18 days later) » 

12:22 AM
just realized some stuff when self-implemented is actually faster sometimes
awesome
 
 
3 hours later…
3:37 AM
@RubenVerg it's awful for text storage size
also all the other stuff mentioned
 
 
4 hours later…
8:04 AM
@AlexisKing A really common case is when you want to limit some field to X characters and cut it off with ... if it goes over.
Or if you want to for example show some context around an validation error
 
 
2 hours later…
10:23 AM
0
Q: Where can I find the machine code manual of a computer?

user1514263I learnt that the complete set of things that a computer can do, is the set of machine code instructions that it was built to carry out. (Q) In the olden days, a machine code instruction was written directly to the terminal (which back then was a screen hardware) and the resulting output was show...

 
 
2 hours later…
12:13 PM
wait, is this pl dev/impl or is it hardware/software stuff?
 
not pldi
 
 
1 hour later…
1:21 PM
0
Q: Why isn't the nullable marker in Dart a monad?

Michael TsangConsider the following code: typedef Nullable<T> = T?; Nullable<T> unit<T>(T x) => x; Nullable<U> bind<T, U>(Nullable<T> x, Nullable<U> Function(T) f) => x == null ? null : f(x); final int? x = null; Nullable<bool> f(int? y) => y == null ? true : y > 0 ? false : null; Nullable<String> g(boo...

 
 
5 hours later…
6:48 PM
@mousetail But, as Alexis said, if you want to limit a string to X characters then code point indexing isn’t correct, you want (extended) grapheme clusters; taking a prefix is not random access either
 
6:59 PM
@NewPosts Something like “where can I find official documentation of the assembly/instruction set for a specific CPU” is probably just on-topic, but this question is deeply confused
 
@mousetail Doing this based on code points is a pretty bad idea in general, since ﷽, for example, is one code point!
Even extended grapheme clusters don’t really help you here; you need to have the ability to actually measure the glyphs in the font you’re using.
 
7:43 PM
For many cases a fast dirty approach is good enough even if it's inaccurate for some scripts
 
 
2 hours later…
9:19 PM
Again, though, extracting a contiguous block from a known start point is not random access — it's a linear operation, so it can do text segmentation and font metrics as applicable along the way
Random access to strings does come up in parsing some fixed-size text-based data formats, but those aren't really text, and there isn't much other than that
I am partial to the Raku string design, which does have random access to grapheme clusters, but it's a lot of complication for honestly not a huge amount of benefit
 
 
1 hour later…
10:38 PM
Swift works that way, too, and I agree, I think it’s very cool but ultimately not actually that useful
 
Swift string indices are opaque non-numeric values that you can advance, so you can only have random access to a point you've already been to
I think that is basically the morally-correct approach but it can be annoying to use
 
Ah, you’re right, that’s a good point
 

« first day (374 days earlier)      last day (18 days later) »