Re: [go-nuts] Re: new range over int docs?

2024-02-07 Thread Rob Pike
Ha ha, someone forgot to change the year. It should read Jan 30, 2024. That's confusing. -rob On Wed, Feb 7, 2024 at 8:47 PM peterGo wrote: > Jason, > > The Go 1.22 source code says: > > "Subtitle": "Language version go1.22 (Jan 30, 2023)", > > Blame > > #569 9289b9c gri@*.***

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-13 Thread Rob Pike
ob On Sun, Jan 14, 2024 at 9:31 AM Rob Pike wrote: > Oh, I did say my implementation was straightforward. It's free of any > clever multiplication algorithms or mathematical delights. It could easily > be giving up 10x or more for that reason alone. And I haven't even profiled

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-13 Thread Rob Pike
Probably they use Schönhage-Strassen multiplication algorithm for very > large numbers as the 1E8! result will have over a 3/4 billion digits. I > should try this in Gambit-Scheme (which has an excellent multiply > implementation). > > On Jan 12, 2024, at 9:32 PM, Rob Pike wrot

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-12 Thread Rob Pike
ges including go: > https://github.com/PeterLuschny/Fast-Factorial-Functions > > On Jan 8, 2024, at 9:22 PM, Rob Pike wrote: > > Here's an example where it's the bottleneck: ivy factorial > > > !1e7 > 1.20242340052e+65657059 > > )cpu > 1m10s (1m10s user, 167.330ms sy

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-08 Thread Rob Pike
t;> {math.MaxUint64 - 3, math.MaxUint64, >> "115792089237316195360799967654821100226821973275796746098729803619699194331160"} >> ``` >> >> On Sun, Jan 7, 2024 at 6:34 AM John Jannotti wrote: >> >>> I'm equally curious. >>> >>> FWIW,

Re: [go-nuts] Any interest in nat.mulRange simplification/optimization?

2024-01-06 Thread Rob Pike
It seems reasonable but first I'd like to understand why the recursive method is used. I can't deduce why, but the CL that adds it, by gri, does Karatsuba multiplication, which implies something deep is going on. I'll add him to the conversation. -rob On Sun, Jan 7, 2024 at 5:46 PM John

Re: [go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Rob Pike
If it's only in the test, the circularity only arises when testing both packages in a single build. That doesn't happen so is not a problem at all, and in fact the stdlib is full of such circularities involving common packages like fmt. -rob On Wed, Dec 20, 2023 at 7:49 AM Jan Mercl

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread Rob Pike
I just did a simple test with a 2M line file and it worked fine, so I suspect it's a bug in your code. But if not, please provide a complete working executable example, with data, to help identify the problem. -rob On Thu, Oct 12, 2023 at 7:39 PM 'Mark' via golang-nuts <

Re: [go-nuts] Re: From which programming language did the idea for Golang's interface mechanism design originate?

2023-08-24 Thread Rob Pike
It was dreamed up independently at the whiteboard on the first day of design discussions. We did not know Emerald at the time; the similarity was discovered later. This is not to claim the idea is original, just that we discovered it independently. -rob On Fri, Aug 25, 2023 at 1:57 PM Andrew

Re: [go-nuts] binary.ByteOrder

2023-08-10 Thread Rob Pike
First read https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html then see https://go.dev/play/p/4ESm6nOwgtY -rob On Thu, Aug 10, 2023 at 8:46 PM Stephen Illingworth < stephen.illingwo...@gmail.com> wrote: > Hello, > > I want to detect the implementation of binary.ByteOrder.

Re: [go-nuts] go package dating back to 2009

2023-07-26 Thread Rob Pike
I am delighted to learn that I, the original author of Go's fmt and bytes packages, am actually Satoshi Nakamoto. I always wondered who he was. Thanks for clearing that up. All kidding aside, I do not understand what you are trying to achieve by claiming authorship of this code. Or even if that's

Re: [go-nuts] Re: Amateur's questions about "Go lang spec"

2023-06-11 Thread Rob Pike
Although the sentence is OK as it stands, the section should be tweaked a bit. One of the examples there (myString(0x65e5)) is valid Go but vet rejects it, as part of the move towards disallowing this conversion, which was there mostly for bootstrapping the libraries. -rob On Mon, Jun 12, 2023

Re: [go-nuts] How to detect a reflect.Value of nil ?

2023-06-01 Thread Rob Pike
I find this situation unsatisfactory. See https://github.com/golang/go/issues/51649 for my suggested fix. -rob On Fri, Jun 2, 2023 at 4:52 AM Ian Lance Taylor wrote: > On Thu, Jun 1, 2023 at 11:48 AM christoph...@gmail.com > wrote: > > > > I have a method that receives a reflect.Value as

Re: [go-nuts] Map of Types is impossible, is there any alternative solution?

2023-04-11 Thread Rob Pike
I had written out a message to suggest this approach but deleted it because it still required a type switch afterwards. Later I realized that the variant types of the message could easily be handled by an interface, like this: type Message interface { Build([]byte) Message Handle() error }

Re: [go-nuts] Interesting "select" examples

2023-04-03 Thread Rob Pike
Here's an excerpt from a piece of concurrent code I like, an unpublished interactive game of life. The select near the bottom has only two cases but it is perhaps instructive. I leave its analysis to the reader. -rob var kbdC chan of rune = ... // events from keyboard var ticker =

Re: [go-nuts] Re: Why can't a regexp.Regexp be const

2023-02-14 Thread Rob Pike
I suggest two changes. First, always use backquotes `` around regular expressions to avoid misunderstandings should a backslash occur. Second, in this case if M|m is just a choice and not a subexpression you need to track, you can make it easier to read by using character classes to reduce the

Re: [go-nuts] Can I use the Golang logo on my site about Golang?

2023-01-18 Thread Rob Pike
golang.ru is a good name for such a site, but please keep in mind that the language itself is called just Go, as the logo itself should make clear. -rob On Thu, Jan 19, 2023 at 4:05 AM Ian Lance Taylor wrote: > On Wed, Jan 18, 2023 at 8:30 AM Василий Рузин wrote: > > > > Can I use the Golang

Re: [go-nuts] Re: clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Rob Pike
Let me ask, because I'm genuinely curious: Why does it matter? The labels we apply to things do not affect their function. Perhaps it affects how we think about them. Is that it? -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: Unicode variable name error

2022-11-06 Thread Rob Pike
% unicode -d పే U+0C2A 'ప' telugu letter pa U+0C47 'ే' telugu vowel sign ee % unicode -U C2A C47 U+0C2A 'ప' TELUGU LETTER PA category: Lo canonical combining classes: 0 bidirectional category: L mirrored: N U+0C47 'ే' TELUGU VOWEL SIGN EE category: Mn canonical combining classes: 0

Re: [go-nuts] What's the maximum array length?

2022-10-27 Thread Rob Pike
Ah, and here's why. cmd/internal/obj/objfile as a 32-bit data size. if int64(uint32(dataOff)) != dataOff { log.Fatalf("data too large") } On Fri, Oct 28, 2022 at 3:15 PM Rob Pike wrote: > For those watching at home, the error message is > > compile: data too large >

Re: [go-nuts] What's the maximum array length?

2022-10-27 Thread Rob Pike
For those watching at home, the error message is compile: data too large -rob On Fri, Oct 28, 2022 at 12:43 PM eric...@arm.com wrote: > The spec says that " The length is part of the array's type; it must > evaluate to a non-negative constant >

Re: [go-nuts] what is the origin of Go's reference time system?

2022-10-27 Thread Rob Pike
Not without breaking compatibility. -rob On Thu, Oct 27, 2022 at 5:15 PM Alex Besogonov wrote: > Can we perhaps get a bit more unambiguous reference date for it? > > On Wednesday, October 26, 2022 at 1:06:36 PM UTC-7 Rob 'Commander' Pike > wrote: > >> I believe it's unique. I thought of it

Re: [go-nuts] what is the origin of Go's reference time system?

2022-10-26 Thread Rob Pike
I believe it's unique. I thought of it one day while walking home. It is inspired by the way Cobol picture clauses represent number formats. (That said, I've never programmed in Cobol.) -rob On Thu, Oct 27, 2022 at 4:51 AM Ayan George wrote: > > I'm really impressed by the simplicity of Go's

Re: [go-nuts] Re: behavior of %f

2022-10-10 Thread Rob Pike
This behavior is how floating-point math works, which is not best addressed in the documentation for the formatted I/O library. We see may comments from people new to floating point who argue that there are bugs in Go's arithmetic, but it's invariably a lack of familiarity with the—admittedly

Re: [go-nuts] int64(math.Inf(+1)) != math.MaxInt64

2022-10-03 Thread Rob Pike
Looks like a bug to me, so I filed https://github.com/golang/go/issues/56023 Thanks for reporting it. -rob On Tue, Oct 4, 2022 at 1:18 PM Jonathan Pearson wrote: > I expected int64(math.Inf(+1)) == math.MaxInt64, but it does not. > > In fact, these three values are equal: >

Re: [go-nuts] tip: data race when running test with coverage

2022-10-02 Thread Rob Pike
This is a race in new code, then, so please file an issue at https://go.dev/issue/new -rob On Sun, Oct 2, 2022 at 7:40 PM Shulhan wrote: > > On Sun, 2 Oct 2022 19:22:21 +1100 > Rob Pike wrote: > > > Apologies, the cover tool calls it -mode but the go command calls it > >

Re: [go-nuts] tip: data race when running test with coverage

2022-10-02 Thread Rob Pike
Also, it is documented: % go help testflag | grep mode -covermode set,count,atomic Set the mode for coverage analysis for the package[s] When 'go test' runs in package list mode, 'go test' caches successful % On Sun, Oct 2, 2022 at 7:22 PM Rob Pike wrote: > Apologies, the cover t

Re: [go-nuts] tip: data race when running test with coverage

2022-10-02 Thread Rob Pike
Apologies, the cover tool calls it -mode but the go command calls it -covermode. go test -covermode=atomic -rob On Sun, Oct 2, 2022 at 3:48 PM Shulhan wrote: > On Sun, 2 Oct 2022 10:41:17 +1100 > Rob Pike wrote: > > > When running coverage in a concurrent program, use t

Re: [go-nuts] tip: data race when running test with coverage

2022-10-01 Thread Rob Pike
When running coverage in a concurrent program, use the -mode=atomic flag to avoid data races in the counters. This unavoidably has a significant performance hit, but it should resolve this race. -rob On Sun, Oct 2, 2022 at 5:10 AM Shulhan wrote: > Hi gophers, > > The latest Go tip always fail

Re: [go-nuts] Go routine context

2022-09-30 Thread Rob Pike
One of the critical decisions in Go was not defining names for goroutines. If we give threads/goroutines/coroutines (TGCs) names or other identifiable state, such as contexts, there arises a tendency to push everything into one TGC. We see what this causes with the graphics thread in most modern

Re: [go-nuts] Unicode AzeriCase == TurkishCase?

2022-09-25 Thread Rob Pike
I believe so, but unicode.org is the place to research that question. Whatever Go does is defined by Unicode 13.0.0 at the moment. -rob On Mon, Sep 26, 2022 at 11:54 AM Holloway Kean Ho wrote: > > Hi all, > > Just to confirm, is the unicode special case "AzeriCase" == "TurkishCase"? > >

Re: [go-nuts] Re: private go documentation server similar to https://pkg.go.dev

2022-09-11 Thread Rob Pike
Yes, godoc. I need more sleep. -rob On Sun, Sep 11, 2022 at 6:39 PM Jan Mercl <0xj...@gmail.com> wrote: > > On Sun, Sep 11, 2022 at 4:20 AM Rob Pike wrote: > > > It would be nice if gofmt still had its -http option. You could run an > > old version. > > AFAICT,

Re: [go-nuts] Re: private go documentation server similar to https://pkg.go.dev

2022-09-10 Thread Rob Pike
It would be nice if gofmt still had its -http option. You could run an old version. -rob On Sun, Sep 11, 2022 at 8:01 AM peterGo wrote: > > https://go.googlesource.com/pkgsite/ > > On Saturday, September 10, 2022 at 5:28:35 PM UTC-4 brainman wrote: >> >> Hello Everyone, >> >> I would like to

Re: [go-nuts] Add comparisons to all types

2022-05-02 Thread Rob Pike
* Functions: Compare the corresponding memory addresses. The time complexity is constant. There are cases involving closures, generated trampolines, late binding and other details that mean that doing this will either eliminate many optimization possibilities or restrict the compiler too much or

Re: [go-nuts] Golang and virustotal

2022-04-29 Thread Rob Pike
https://go.dev/doc/faq#virus On Fri, Apr 29, 2022 at 8:22 PM Paolo C. wrote: > > Hello, > I noticed that if you download golang portable zip for aMD64 and upload the > go.exe or gofnt.exe to virustotal one av complains. > If you compile a simple helloword main and upload, 4 or 5 minor av

Re: [go-nuts] Re: "\x7f"

2022-03-31 Thread Rob Pike
icode. > The length is accurate. > fmt.Printf("Byte 127 len: %d\n", len([]byte{127})) > > > On Wednesday, June 26, 2013 at 1:16:42 PM UTC-6 gus...@niemeyer.net wrote: >> >> On Wed, Jun 26, 2013 at 4:08 PM, Rob Pike wrote: >> > It is arbitrary. Why do

Re: [go-nuts] Re: Parsing a time as a prefix of a larger string

2022-03-16 Thread Rob Pike
I would approach the problem a different way and ask the question, how do I split the string to separate the time? The time parser doesn't have to be the one to do this. For instance, uou could require a marker (if the word INFO or its substitute isn't already one), such as a spaced hyphen:

Re: [go-nuts] Pointer to a pointer

2022-03-15 Thread Rob Pike
Actually the one I was referring to is in the main repo at test/peano.go, but it's the same idea. -rob On Tue, Mar 15, 2022 at 10:10 PM Jochen Voss wrote: > > Thanks for the pointer to peano.go, this is fun! > > It took me a while to locate the file. In case others are interested: > peano.go

Re: [go-nuts] Pointer to a pointer

2022-03-10 Thread Rob Pike
This topic has come up before. The scope of the identifier is set up to allow, unlike in C, constructs such as type stateFunction func() stateFunction as is used in my talk about a scanner, https://talks.golang.org/2011/lex.slide As I mentioned above, recursive type definitions appear even in

Re: [go-nuts] Pointer to a pointer

2022-03-10 Thread Rob Pike
On Thu, Mar 10, 2022 at 5:08 PM shan...@gmail.com wrote: > > Is this really how you want to be known? Sure, why not? It's a more interesting program than one might think. For a richer example of the foundational idea here, see the peano.go program in the test directory in the repo. -rob --

Re: [go-nuts] Pointer to a pointer

2022-03-09 Thread Rob Pike
Here's a program with 1000 *s. You can see the pattern, make it any number you like. https://go.dev/play/p/FZXWcQTutEG // You can edit this code! // Click here and start typing. package main import "fmt" type self *self func main() { var p self p =

Re: [go-nuts] Re: Why, oh why, do people do this? Things that annoy me in Go code.

2022-03-07 Thread Rob Pike
It could have been interface UnreceivedMasterOrdersInterfaceThatCanBeUsedToCallGetUnreceivedByProductsWarehouseAndCompany Seriously, though, your example isn't even on the same planet as some of the examples I've seen. (Neither is my parody.) Sympathies. -rob On Tue, Mar 8, 2022 at 7:49 AM

Re: [go-nuts] How Does This Work?

2022-03-06 Thread Rob Pike
Be careful. You are correct but newcomers to Go often get confused here. Printf unpacks the interface it is passed to find the concrete element inside. Doing what reflect requires you to do to discover the type of an interface is unrelated to the problem at hand. Watch: % cat x.go package main

Re: [go-nuts] Looping and tail-end code

2022-01-12 Thread Rob Pike
What's wrong with for ;; time.Sleep(delay) { ... } ? This technique is as old as the hills. Or at least as old as C for loops. -rob On Wed, Jan 12, 2022 at 9:02 PM Tobias Klausmann wrote: > > Hi! > > Often with tools that poll something, you get code of this form: > > ``` > for { >

Re: [go-nuts] Re: Do you have a minimal runnable go code that contain all key words in go?

2021-12-07 Thread Rob Pike
Oh, it needs to be runnable. Never mind. -rob On Wed, Dec 8, 2021 at 11:19 AM Rob Pike wrote: > > It's easy to fold a few things together: https://go.dev/play/p/6lpZmGH9iJb > > Nice work though. > > On Wed, Dec 8, 2021 at 5:15 AM ben...@gmail.com wrote: > > > > He

Re: [go-nuts] Re: Do you have a minimal runnable go code that contain all key words in go?

2021-12-07 Thread Rob Pike
It's easy to fold a few things together: https://go.dev/play/p/6lpZmGH9iJb Nice work though. On Wed, Dec 8, 2021 at 5:15 AM ben...@gmail.com wrote: > > Heh, nice! I made it three bytes smaller by defining "const t = true" (true > was used in 2 places). https://go.dev/play/p/-3SvzKYjGSr ... I

Re: [go-nuts] Q: Why does Gob deserialize a ptr to an empty string back as null?

2021-12-01 Thread Rob Pike
Gob does not encode pointers as different from values. The stream is a stream of values. How many indirections it takes the values to come to the stream is not recorded. A consequence of that, combined with not sending zero values, is that empty strings and nil pointers to strings are encoded the

Re: [go-nuts] Re: gob: decoding into local type []float64, received remote type []float

2021-11-29 Thread Rob Pike
The encoder delivers a stream that includes type information. If you reuse the stream to a different decoder, that decoder will not have seen the type information sent to the first one. Or to look at it another way, the encoder just sends the values you give it, along with any type information

Re: [go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread Rob Pike
See also https://github.com/golang/go/issues/29982. It gets more interesting towards the bottom, but the proposal is on hold. Be nice to release it again though. I do favor it. -rob On Tue, Oct 26, 2021 at 8:48 AM Ian Lance Taylor wrote: > > On Sun, Oct 24, 2021 at 4:45 PM jlfo...@berkeley.edu

Re: [go-nuts] slices grow at 25% after 1024 but why 1024?

2021-09-04 Thread Rob Pike
What would you pick? You need to pick something. It was just arbitrary, I'm sure. 1024 is a nice number, and it's larger than the length of many slices. Sometimes a number is just a number. -rob On Sun, Sep 5, 2021 at 3:14 AM Miraddo wrote: > Hey Guys, > > We know slices grow by doubling

Re: [go-nuts] Re: Is there a preview Golang version I can download to try out generics ?

2021-08-22 Thread Rob Pike
> > > (But in the normal case you shouldn't have to set GOOS/GOARCH > yourself, the build process should pick the right ones.) Although this sounds like good advice, my experience suggests that one be explicit. The Apple on-the-fly handling of binary translation means both that you must

Re: [go-nuts] Golang language specification Document: Composite Literals example is not understandable

2021-06-22 Thread Rob Pike
That creates a slice 101 integers long, which probably isn't what you meant, which might help explain why you never came across it before. Smile. -rob On Wed, Jun 23, 2021 at 7:07 AM jake...@gmail.com wrote: > I'm surprised that I have never come across this as a way to create a > slice with

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-06 Thread Rob Pike
Can you explain the trap? I don't pick up that vibe, but I may be the author of that paragraph. Plus there is no such thing as a big interface. In the current implementation, all interfaces are the same size - a pair of words. You may still have a misapprehension. Try the first half of this

Re: [go-nuts] Re: Why the limit on regex repeat is 1000?

2021-06-06 Thread Rob Pike
The reason is that the only way to implement repetition in an NFA or DFA is literally to repeat the expression, so asking for `a{6}` means to generate the machine for `aa`. It is a notational convenience only, a macro mechanism if you will. Other "regexp" packages, which do not adhere to the

Re: [go-nuts] Why the limit on regex repeat is 1000?

2021-06-06 Thread Rob Pike
It is to protect the regexp engine from overly expensive computations, as the repetition can introduce quadratic behavior in the compiler. The Go engine is concerned about pathological execution - not all engines have this property (see https://swtch.com/~rsc/regexp/regexp1.html) - and is being

Re: [go-nuts] Is it possible to produce coverage profiles for *_test.go files?

2021-05-19 Thread Rob Pike
You could run go tool cover yourself, but getting the details right can be difficult. Instead, I suggest moving the test code into the main package, but protected by a build tag and called from the real test. foo_test.go: func TestFoo(t *testing.T) { mainTestFoo(t) } foo.go: func mainTestFoo(t

Re: [go-nuts] Go Create

2021-01-12 Thread Rob Pike
Jim, I used replace this way just yesterday. It works fine, but is not easily discoverable as a process and it took me a minute or two to figure it out. Also, one must be sure to remove the replace directive before releasing the code, which is an easy detail to forget. The same trick (and

Re: [go-nuts] Ballooning Executable Sizes

2020-11-19 Thread Rob Pike
Filed https://github.com/golang/go/issues/42729 On Fri, Nov 20, 2020 at 6:34 AM stephen.t@gmail.com < stephen.t.illingwo...@gmail.com> wrote: > Hello, > > I have a reasonably sized project that produces executables that have > ballooned in size between two relatively simple commits. > > I've

Re: [go-nuts] Are float64 and float32 exact in Golang (like strictfp in Java)

2020-09-25 Thread Rob Pike
There is more than one Go compiler and the use of fused-multiply-add is not guaranteed. The Go spec permits FMA but does not require it. I suggest reading the "Floating-point operators" section of the specification for clarity here. -rob On Sat, Sep 26, 2020 at 9:23 AM Ian Lance Taylor

Re: [go-nuts] Find n-th root of a big number

2020-09-22 Thread Rob Pike
I'm not going to debug you program for you - you'll learn more doing it yourself, but I glanced at it and saw immediately that you're missing an easy optimization. Raising a number to an integer power can be done much faster by repeated squaring according to the bit pattern of the exponent. I'll

Re: [go-nuts] Re: Efficient bitmask twiddling

2020-09-01 Thread Rob Pike
It's not a bit array, it's a bool array. Can you make it a bit array and use bit != 0 for the boolean elsewhere? -rob On Wed, Sep 2, 2020 at 5:55 AM Oliver Smith < oliver.sm...@superevilmegacorp.com> wrote: > Do godbolt links get eaten? https://godbolt.org/z/vbeobs > > On Tuesday, September 1,

Re: [go-nuts] Re: Speed up png.Decode

2020-06-26 Thread Rob Pike
Without information about the particular images - the data set you're working with - it's hard to provide any accurate advice. If the images are small, maybe it's all overhead. If the images are of a particular form of PNG, maybe a fast path is missing. And so on. To get meaningful help for

Re: [go-nuts] Why isn't there "number plus" postfix syntax for more than or equal?

2020-04-23 Thread Rob Pike
if r == 13 despiteallobjections { ... } -rob On Fri, Apr 24, 2020 at 8:04 AM 'Dan Kortschak' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I look forward to the addition of the definition of "in a handwavy > sense" to the spec. > > On Thu, 2020-04-23 at 11:41 -0700, Michael Jones

Re: [go-nuts] testing code that uses ioutil.ReadDir?

2020-04-12 Thread Rob Pike
I am the author of the test coverage tool, and I do not believe that 100% code coverage is the right goal. Coverage is a proxy for testing quality, but not a guarantee of it. Getting to 100% coverage is a better indicator of chasing metrics than of actually writing good tests. I'm happy if my

Re: [go-nuts] correction in make documentation

2020-04-11 Thread Rob Pike
It's not just the size, though, it's also what kind of thing gets made. I think it's better as is. -rob On Sun, Apr 12, 2020 at 6:02 AM Feroz Jilla wrote: > Hello community :) > > I was going through the golang documentation on the `make` function here - >

Re: [go-nuts] Is this code in package unix assuming machine endianess?

2020-03-11 Thread Rob Pike
More context, in the form of self-promotion: https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html -rob On Wed, Mar 11, 2020 at 9:42 PM Tom Parkin wrote: > On Tue, 10 Mar 2020 at 23:14, Ian Lance Taylor wrote: > >> On Tue, Mar 10, 2020 at 4:03 PM Tom Parkin wrote: >> > >> > I'm

Re: [go-nuts] Re: Why isn't there strings.reverse("str") function?

2020-02-27 Thread Rob Pike
Once bytten, twice shy. -rob On Fri, Feb 28, 2020 at 10:17 AM Jesper Louis Andersen < jesper.louis.ander...@gmail.com> wrote: > The key observation is that you only look at a byte once. > > On Thu, Feb 27, 2020, 22:49 Amnon Baron Cohen wrote: > >> You are right. >> I had wrongly assumed that

Re: [go-nuts] why golang unicode katakana table don't include 0x30fc ..

2019-12-10 Thread Rob Pike
That's a good question and I haven't figured it out, but I bet it has to do with U+30fb not being in L class: % unicode -d -U 30fa 30fb 30fc U+30FA 'ヺ' KATAKANA LETTER VO category: Lo canonical combining classes: 0 bidirectional category: L character decomposition mapping: 30F2 3099

Re: [go-nuts] using or extending or forking+renaming github.com/google/licensecheck to provide similar functionality

2019-11-14 Thread Rob Pike
ingLicenseReferences.c > > Command listlicenses iterates over all files in the subtree, gathering > all full or partial (broken) license references. Command listlicenses > uses the functionality similar to github.com/google/licensecheck to > check the files in the file system. > > >

Re: [go-nuts] using or extending or forking+renaming github.com/google/licensecheck to provide similar functionality

2019-11-13 Thread Rob Pike
Can you please explain in more detail what you're asking for? I don't understand the problem you have or why the current package cannot handle it. -rob On Wed, Nov 13, 2019 at 7:05 PM wrote: > Hi, > > "licensecheck classifies license files and heuristically determines > how well they

Re: [go-nuts] Channels may not be the best solution in Go

2019-10-05 Thread Rob Pike
> > > Not all programs benefit from concurrency. Writing concurrent code for > essentially sequential programs will not benefit from multiple cores, > like generating prime numbers. Do not forget that concurrency includes > overhead for context switch and memory barriers. Using channels in a >

[go-nuts] Go Time #100 with Robert Griesemer and myself

2019-09-25 Thread Rob Pike
It's now live: https://changelog.com/gotime/100 -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from

Re: [go-nuts] select on slice of channels

2019-09-13 Thread Rob Pike
The feature was in Newsqueak but we deliberately omitted it from Go because the cost of the operation can be very high and we weren't comfortable provided such concise notation for such an expensive operation. -rob On Fri, Sep 13, 2019 at 4:02 PM Ian Lance Taylor wrote: > On Thu, Sep 12, 2019

Re: [go-nuts] Go string and UTF-8

2019-08-20 Thread Rob Pike
Printf can print hexadecimal just fine. Never understood the point of encoding/hex. Meanwhile, for questions about strings, see blog.golang.org/strings. -rob On Tue, Aug 20, 2019 at 9:00 PM Sam Whited wrote: > I personally wouldn't do this. If you're going to incur the overhead of a > heap

Re: [go-nuts] Gob encoding not working to NFS

2019-06-14 Thread Rob Pike
The problem is that os.NewFile makes a new File struct; it doesn't create a file. Also, the first argument should be an open file descriptor, not a flag. I think you want to use os.Create. You certainly don't want NewFile. -rob On Sat, Jun 15, 2019 at 12:21 AM wrote: > I have been writing

Re: [go-nuts] Re: A good indicator of code quality

2019-06-10 Thread Rob Pike
"[T]he Heisenberg Uncertainty Principle says that you cannot measure something without changing it". Actually no, that is the Observer Paradox. The Heisenberg Uncertainty Principle states that the product of the uncertainty of complementary variables, such as momentum and position, can never be

Re: [go-nuts] Creating a request language from scratch

2019-06-07 Thread Rob Pike
Some minor advice: https://commandcenter.blogspot.com/2011/08/regular-expressions-in-lexing-and.html -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] Re: Interesting public commentary on Go...

2019-05-24 Thread Rob Pike
If that's true - and it might well not be - it's a surprise to me. When launching the language we explicitly made sure NOT to trademark it. -rob On Fri, May 24, 2019 at 10:50 AM Gerald Henriksen wrote: > On Fri, 24 May 2019 07:40:52 +1000, you wrote: > > >The last sentence of the article is

Re: [go-nuts] Re: Interesting public commentary on Go...

2019-05-23 Thread Rob Pike
The last sentence of the article is not correct. The name Go is not trademarked by Google, at least as a programming language trademark. There are other things Google makes called Go (an interesting signal on its own) and they might be trademarked, but Go the language is not a trademark. -rob --

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Rob Pike
wrote: > On Sat, 2019-05-18 at 09:43 +1000, Rob Pike wrote: > > Australia is closer to Britain but sticks with jail > > and tire. > > I don't think this is true Australia wide - in Melbourne and Adelaide > (my home cities), I have always seen gaol and tyre. > > >

Re: [go-nuts] Re: the Dominance of English in Programming Languages

2019-05-17 Thread Rob Pike
It is of course more complicated than most people believe. The right is often wrong; the wrong often has long precedence. The British -ise ending is an early 20th century misguided respelling based on invalid theories of etymology. Programme is just something that came out of the blue, from

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-25 Thread Rob Pike
I am pretty sure that the decision not to have ?: in Go was a unanimous decision by Robert, Ken and myself after almost no discussion. It is too easy to abuse, as the FAQ states. -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] how to get file's current offset

2019-04-19 Thread Rob Pike
I just use 1 so I don't have to look up what it's called these days, but I'm seriously old school. -rob On Sat, Apr 20, 2019 at 3:19 AM Michael Jones wrote: > I’ve been doing that since 6th Edition, 1976/77 > > On Thu, Apr 18, 2019 at 8:00 AM andrey mirtchovski > wrote: > >> > offset, err :=

Re: [go-nuts] Re: Learning Data Structures and algorithms with Golang

2019-04-14 Thread Rob Pike
Bhagvan: Please note that the language is called Go, not Golang. -rob On Mon, Apr 15, 2019 at 1:49 AM Robert Solomon wrote: > I actually find it useful to have these posted here. I'm a notice Go > programmer, and these references help me. > I also saw a reference to "Hands On GUI

Re: [go-nuts] Pointer declaration syntax

2019-03-10 Thread Rob Pike
& turns a value into a pointer. * turns a pointer into a value. Whether a pointer should be declared with & or * or "ptr" or anything else is an arbitrary decision made the way it was by the Go designers because, as Ian says, C did it with *. -rob On Mon, Mar 11, 2019 at 10:22 AM Michael Jones

Re: [go-nuts] go vet tool

2019-03-04 Thread Rob Pike
Ah, yes it does work, if not documented in 'go help vet'. Thanks. -rob On Tue, Mar 5, 2019 at 10:20 AM Ian Lance Taylor wrote: > On Mon, Mar 4, 2019 at 2:00 PM Rob Pike wrote: > > > > The help for go vet does not mention that one can pass individual files, > only packag

Re: [go-nuts] go vet tool

2019-03-04 Thread Rob Pike
The help for go vet does not mention that one can pass individual files, only packages. -rob On Tue, Mar 5, 2019 at 6:20 AM Ian Lance Taylor wrote: > On Sun, Mar 3, 2019 at 11:02 PM wrote: > > > > Is it possible to use go vet as go tool vet . With go > vet it is giving no go source files,

Re: [go-nuts] go vet tool

2019-03-04 Thread Rob Pike
I do wish it were still possible to do "go vet file.go" or "go vet directory" although I do understand why it is not (type checking). Over time, everything gets better but also worse and always bigger and more complex. -rob On Mon, Mar 4, 2019 at 6:02 PM wrote: > Is it possible to use go vet

Re: [go-nuts] Is Go a single pass compiler?

2019-02-27 Thread Rob Pike
The Go compiler was single pass until we allowed use before declaration. -rob On Thu, Feb 28, 2019 at 10:46 AM wrote: > Thanks, Ian. > > I remember reading in some compiler book that languages should be designed > for a single pass to reduce compilation speed. > > Go proves that wrong :) It's

Re: [go-nuts] efficient random float32 number generator?

2019-02-25 Thread Rob Pike
If you don't need precision, just generate ints and scale them. -rob On Tue, Feb 26, 2019 at 9:39 AM DrGo wrote: > Thanks Ian, > The std lib float32 is slow for my purpose. In my benchmarking it is > actually slower than the float64. But I don’t even need float16 precision. > I am working on

Re: [go-nuts] Mismatched types work sometimes?

2019-02-11 Thread Rob Pike
You might find blog.golang.org/constants helpful. -rob On Tue, Feb 12, 2019 at 5:04 AM Jamie Caldwell wrote: > Thanks for the help and quick response Tyler. > > On Mon, 11 Feb 2019 at 17:56, Tyler Compton wrote: > >> Constant expressions like 'A' or 3 or named constants like "const x = 7" >>

Re: [go-nuts] Modules. A "new" system.

2019-02-05 Thread Rob Pike
% ivy */iota 1000

Re: [go-nuts] Modules. A "new" system.

2019-02-05 Thread Rob Pike
Oberon inspired a number of languages. For instance, Limbo's GC also collects files, and modules are just objects you assign to when importing them, and are collected when no longer referenced. -rob On Wed, Feb 6, 2019 at 10:06 AM Michael Jones wrote: > ha ha! yes indeed. i was counting

Re: [go-nuts] Using "er" and "able" for interfaces

2019-01-17 Thread Rob Pike
It depends on the nature of the verb (method) and whether it's being used to refer to the subject or the object, whether it is transitive or intransitive, and all the rest of that messy human grammar nonsense. Which is why trying to align the with justifications to English grammar is a fool's

Re: [go-nuts] Re: What are the reasonable reasons to use pointers?

2019-01-07 Thread Rob Pike
e, and after > that, all the "2" arguments in my program were invisibly changed. > > I was 16 or 17, was an explorer scout at BTL, and was quick to embrace 6th > edition UNIX and ed over TOPS-10 and TECO (ignoring the brilliantly named > SOS, "son of stopgap") > &g

Re: [go-nuts] Re: What are the reasonable reasons to use pointers?

2019-01-06 Thread Rob Pike
Fortran depends heavily on pointers for its semantics: It is a call by reference language. You just don't see them explicit in the language and you have no control over whether an argument will be modified by a procedure. -rob On Mon, Jan 7, 2019 at 5:13 AM Victor Giordano wrote: > i guess

Re: [go-nuts] Adding &&= and ||= operators for working with bools

2019-01-05 Thread Rob Pike
edit: seems NOT worth it. -rob On Sun, Jan 6, 2019 at 4:16 PM Rob Pike wrote: > That link doesn't work - it's into your mailbox. > > However, I do remember talking about this option some time ago, including > when the language was first being designed. It didn't seem c

Re: [go-nuts] Adding &&= and ||= operators for working with bools

2019-01-05 Thread Rob Pike
That link doesn't work - it's into your mailbox. However, I do remember talking about this option some time ago, including when the language was first being designed. It didn't seem common enough to warrant adding, and C got along fine without it. Your regularity argument carries some weight but

Re: [go-nuts] if/switch statements as expressions

2018-12-19 Thread Rob Pike
BCPL had a construct like this, and we did consider doing something analogous, but in the end Go is not an expression language. C and BCPL are, and that property does lead to problems, although they are probably avoidable with careful language design. But Go is not an expression language, so

Re: [go-nuts] Re: Plan9 reborn as a guest OS atop of Golang runtime

2018-12-11 Thread Rob Pike
man achievement in OS design: > Inferno. > > https://en.wikipedia.org/wiki/Inferno_(operating_system) > http://www.vitanuova.com/inferno/ > https://bitbucket.org/inferno-os/inferno-os > > Inferno was written in the early 90's by Ken Thompson, Rob Pike, Roger > Peppé, Dennis Ritchie,

  1   2   3   >