Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-16 Thread 'Axel Wagner' via golang-nuts
On Mon, Jan 16, 2023 at 1:27 PM Bakul Shah wrote: > I would think the map iteration order is *arbitrary* but deterministic. > That is, the same set of keys will be iterated the same way every time. > If you would think that, you'd be wrong. The iteration order of a map is unspecified. But gc (th

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-16 Thread Bakul Shah
I would think the map iteration order is arbitrary but deterministic. That is, the same set of keys will be iterated the same way every time. This is not the case with the select statement. > On Jan 16, 2023, at 1:34 AM, 'Axel Wagner' via golang-nuts > wrote: > > I think the question of "when

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-16 Thread 'Axel Wagner' via golang-nuts
On Mon, Jan 16, 2023 at 3:18 AM Robert Engels wrote: > This is a very strange discussion. I don’t understand the purpose. > Malloc() isn’t even deterministic. Which means any arbitrary program can > take the address to generate entropy regardless of having time, etc > available. > > I didn’t look

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-15 Thread Robert Engels
This is a very strange discussion. I don’t understand the purpose. Malloc() isn’t even deterministic. Which means any arbitrary program can take the address to generate entropy regardless of having time, etc available. I didn’t look it up, but I’m pretty sure there is a “law” that if the langu

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-15 Thread 'Axel Wagner' via golang-nuts
On Mon, Jan 16, 2023 at 12:38 AM Stan Srednyak wrote: > hi Axel, > > thanks for sharing. Why did you mention webassembly specifically, why not > go or c? > I mentioned WebAssembly specifically because a) it has a well sandboxed, single-threaded VM and b) there are existing compilers for Go. I do

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-15 Thread Stan Srednyak
hi Axel, thanks for sharing. Why did you mention webassembly specifically, why not go or c? Stan On Sat, Jan 14, 2023 at 6:37 PM Axel Wagner wrote: > Oh, also, fmt: https://go.dev/play/p/xxOw3vqWR4u (probably need to run > this offline) > > Honestly, I don't think there really is a practical w

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-15 Thread Kevin Chowski
Sorry, I should have read Axel's blogpost before posting. I enjoyed reading it, thanks for sharing :) some of what I was talking about is covered with more code examples in the post. On Sunday, January 15, 2023 at 1:03:50 PM UTC-7 Kevin Chowski wrote: > I think a little more background about t

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-15 Thread Kevin Chowski
I think a little more background about the context of the question would be helpful. Determinism may mean different things in different situations depending ont he guarantees you need. Also, did you know that the go playground (play.golang.org) is intended to be generally deterministic so that

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-14 Thread 'Axel Wagner' via golang-nuts
Oh, also, fmt: https://go.dev/play/p/xxOw3vqWR4u (probably need to run this offline) Honestly, I don't think there really is a practical way to prevent non-determinism without severly hampering the language. Your best bet is probably to compile a program to webassembly and then don't give the VM a

Re: [go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-14 Thread 'Axel Wagner' via golang-nuts
There's also maps, select and goroutines in general. Funnily enough I blogged about this some years ago, for fun . On Sat, Jan 14, 2023 at 11:52 PM Stan Srednyak wrote: > How much of Golang functionality must b

[go-nuts] Guaranteeing deterministic execution of Golang code

2023-01-14 Thread Stan Srednyak
How much of Golang functionality must be excluded in order to guarantee deterministic execution on a fixed system? There are typical sources of nondeterminism 1. /dev/urandom 2. time We should include system variables here, but lets suppose we fix the system. One more source could be syst