Hi,
I read that line as "very old implementations of regular expressions in different languages and systems".
And indeed this documentation hasn't changed since Go v1 (https://pkg.go.dev/regexp@go1#CompilePOSIX), so I'm pretty sure it means that.
In any case I don't think it should affect your usage of the package :)
Joshua
Line "early regular expression implementations used and that POSIX specifies" is a bit confusing to me. I guess it can mean "old implementations Go regexp package",
but also very old implementations of regular expressions in different languages and systems (?).
Another topic. I needed to check package "math/bits" (learning about Go can lead us in such places quite fast) and I'm confused about function "Len(x uint) int". In its description we have (https://pkg.go.dev/math/bi...@go1.17)
BEGINNING
Len returns the minimum number of bits required to represent x; the result is 0 for x == 0.
END
I have no problem with using function that says 0 can be encoded in 0 bits, but it is still odd. Maybe it is connected to something done under the hood, about which I don't know a thing? Does anyone know why this choose was made?
For most inputs the value is strictly determined by what the functions does(number of bits needed to represent), so Len(9) == 3.
To be pedantic, Len(9) == 4:-)
Thank for explanation, but I don't understand "But how many bits do you need to represent 0? The question is malformed as there are no set bits in the used representation of 0.". Why this is malformed questions? When I think of coding 1, I think about thaking one bit with 1 inside and when it goes to 0, I would take one bit with 0 inside.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/RPPfjiuSRHU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/94d8c404-3c25-4897-a582-93b67c6b923an%40googlegroups.com.
I'm not sure what you mean when you say that io.EOF is not treated as an error. io.EOF is an error: it implements the error interface, and is returned as the error value by methods such as Read.
ReadAll reads from r until an error or EOF and returns the data it read. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
But that doesn't mean that it's not an error. The Read failed. Every failure is reported via an error. For the case in which Read fails because it reaches the end of the file, the error that it returns is io.EOF.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9209890e-aa3a-4822-a680-bed6b1804b39n%40googlegroups.com.