Re: [go-nuts] Adding context.Context as first parameter in every function

2024-03-01 Thread Sam Vilain
Hi Yash, unfortunately that's the only approach at the moment. Your request is very apropos of my thread, "Could we trade all the `ctx context.Context` arguments for one pointer in `g`?". This is the exact use case I have in mind.  I believe it should be possible, and even a fairly naïve imple

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-29 Thread Sam Vilain
Thanks for your examples!  I'll cover them in reverse order, to build up the syntax. On 2/29/24 6:18 AM, 'TheDiveO' via golang-nuts wrote: The second example is unit test code, so TEST: https://github.com/thediveo/whalewatcher/blob/cca7f5676b3f63b0e2d6311a60ca3da2fd07ead7/watcher/moby/moby_te

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-28 Thread Sam Vilain
-world examples. On Wednesday, February 21, 2024 at 1:37:05 AM UTC+1 Sam Vilain wrote: Alright, well thanks for your input. I do think these questions can be answered; exploring the use cases in a proposal format should hopefully show that the impact of closures would not normal

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-20 Thread Sam Vilain
this. If you think I am wrong or misunderstanding you, you can always file a proposal to get a more official response. On Tue, Feb 20, 2024 at 8:18 PM Sam Vilain wrote: On 2/17/24 1:32 AM, Axel Wagner wrote: On Sat, Feb 17, 2024 at 2:09 AM Sam Vilain wrote: I would argue th

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-20 Thread Sam Vilain
On 2/17/24 1:32 AM, Axel Wagner wrote: On Sat, Feb 17, 2024 at 2:09 AM Sam Vilain wrote: I would argue that the matter can be simply decided by choosing the /calling/ stack, not the destination stack. I agree that this is *one choice*. But the point is, that *sometimes* you'd

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-16 Thread Sam Vilain
Hey Axel, thanks for the response. /The general reason this has not been accepted for Go, is that passing a Context explicitly removes ambiguities what is meant, in the presence of closures and goroutines./ /If you pass a closure to a different execution context (e.g. via a channel

[go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-16 Thread Sam Vilain
Hi all, Many moons ago I wrote a proposal to make /execution context/ a fundamental concept in Go, effectively moving `context.Context` to being part of the language, not just an extension. The main reason to do this is

Re: [go-nuts] How to test the 'noasm' code?

2023-04-25 Thread Sam Vilain
c optimization is defined? (b) is it possible to write assembly functions that avoid the wrapper code, assuming that one follows the platform's calling convention? Sam On Tuesday, 25 April 2023 at 13:48:57 UTC-4 Ian Lance Taylor wrote: > On Tue, Apr 25, 2023 at 10:03 AM Sam Vilain wro

Re: [go-nuts] How to test the 'noasm' code?

2023-04-25 Thread Sam Vilain
. I'm looking into the contribution guidelines now! Cheers, Sam On Tuesday, 25 April 2023 at 11:59:28 UTC-4 Ian Lance Taylor wrote: > On Tue, Apr 25, 2023 at 8:38 AM Sam Vilain wrote: > > > > I have a module that has a couple of assembly functions (for CLZ aka > BSR/LZC

[go-nuts] How to test the 'noasm' code?

2023-04-25 Thread Sam Vilain
I have a module that has a couple of assembly functions (for CLZ aka BSR/LZCNT, which despite widespread availability[1] don't get any language support). So I've got the assembly versions in per–arch files, and a "noasm" version that builds with "noasm" (amongst other typical conditions. My qu

Re: [go-nuts] Parsing time with timezones seem to fail

2023-02-13 Thread Sam Vilain
> On Feb 13, 2023, at 9:55 AM, Sven Rebhan wrote: > > I do not yet see where timezone abbreviations are ambiguous... Do you mean > there are multiple timezones with the same abbrev? This is certainly not the > case for MST... > What is the point in taking the timezone into account only if tha

Re: [go-nuts] A thought on contracts

2018-09-05 Thread Sam Vilain
Is that the go team's job, though?  It's about go and automatically inferring duck types, so surely we should really be asking DuckDuckGo.Sam -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving email

Re: [go-nuts] Local cache of dependencies

2018-08-22 Thread Sam Vilain
Check out vendetta - it uses git submodules, so you keep a cache of the 3rd party repo in git but not the actual content. You get small repos and reproducible builds.SamOn Aug 22, 2018 3:25 PM, Conor Hackett wrote:Hey Guys,So, adding your "vendor" directory to SCM is a contentious topic at best.I

Re: [go-nuts] Re: Ternary ... again

2018-08-15 Thread Sam Vilain
ess-is-more-and- > is-not-always-straightforward > > So, from my perspective, if you tell me "Python did not have ternary > operators, but after long and hard discussions, they caved", what I'm > hearing is "even *Python* didn't really need them". ;) >

Re: [go-nuts] Re: Ternary ... again

2018-08-14 Thread Sam Vilain
I haven't seen all the discussion referenced, but I remember digging deep into the python language archives where Guido and others eventually relented and added ternaries (with the syntax "a if val else b"). I can't remember the argument which swung the consensus but the arguments against seem rema

Re: [go-nuts] git submodule vs normal go vendoring

2017-10-03 Thread Sam Vilain
In theory, the git submodule builds are *more* reproducible, because all your build servers etc have clones of those sub-repos cached under their .git, even though they are not under your control. If the upstream goes away, you can just re-publish the repo (which you'll have cloned locally) and ad

Re: [go-nuts] Simple web crawler question. How to avoid crawling visited links?

2017-09-24 Thread Sam Vilain
Why not be even more concurrent?Pass "to visit" links to a channel.Reader of channel holds the map, de-dupes and passes to worker channel.Multiple workers dequeue the channel and feed back into the "to visit" channel.SamOn Sep 24, 2017 10:13 AM, Michael Jones wrote:you must remember where you've b

Re: [go-nuts] Built-in log Package

2017-08-15 Thread Sam Vilain
On 8/15/17 7:14 AM, Chris Hines wrote: I would be curious what you think of github.com/go-kit/kit/log (and related "sub"-packages). See my talk about it's design here: Video: https://youtu.be/ojhFQNgyZO4?list=FLcxNiie7-UD8znndwDn7PFw Slides: https://speakerdeck.com/chrishines/go-kit-log-package

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-14 Thread Sam Vilain
x27;t speak for others, I see similar ideas hinted at in > this thread. > > I hope this can help to steer the discussion into the more helpful > underlying questions, instead of getting hung up on details of the current > implementation. > > On Sat, Aug 12, 2017 at 12:59 A

Re: [go-nuts] Built-in log Package

2017-08-14 Thread Sam Vilain
The main problem with the Printf-style interface is that it's not worth building real applications with. For anything with non-trivial logging needs, you need: * tagging of log lines with identifiers such as PID, host, request ID, etc * structured for easier downstream analysis by tools like the

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-11 Thread Sam Vilain
On Monday, 7 August 2017 09:06:23 UTC-7, Daniel Theophanes wrote: > > In the projects I've worked on the switch to Context has been a huge win > all across the board. I think it would be sweet to find an effect way to > make io.Reader take a context (I often want just that, and when I really > n

[go-nuts] Go 2.0 proposal: context scoped variables

2017-08-11 Thread Sam Vilain
Many have written about this; there's an index on Go wiki under ExperienceReports#context including my own writing for the 2016 advent calendar. I would like to propose a simpler way to solve the "optional variable access" part of c

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-07 Thread Sam Vilain
On 11/3/16 10:22 PM, Ian Lance Taylor wrote: > On Thu, Nov 3, 2016 at 10:19 PM, 刘桂祥 wrote: >> can you explain why whis ? > A map is basically a pointer to a complex data structure. Setting a > value in a map changes that data structure. If one goroutine is > reading from the data structure whi

Re: [go-nuts] on GOPATH

2016-09-01 Thread Sam Vilain
Hi Maurizio, I tend to use go vendoring for this purpose. I set GOPATH to $HOME, and this is my "global" environment. Each project is checked out to its module path. Instead of using 'go get' to get dependencies, I use git submodules via vendetta. This checks out all of the dependencies for ea

Re: [go-nuts] Re: What lead to the versionning debate?

2016-08-01 Thread Sam Vilain
On 7/29/16 5:51 PM, Matt Harden wrote: > I like submodules, but they do only work when you're using git and > only vendoring projects that also use git. Or vendoring any dependency which can be mirrored to git, which is essentially all of them. Sam -- You received this message because you are s

Re: [go-nuts] syscall.Read() with timeout: syscall.Select() vs golang's select statement

2016-07-26 Thread Sam Vilain
On 7/26/16 4:05 PM, Matt Harden wrote: > Select and epool actually aren't useful for fd's that are opened on > regular files. As I understand it, they always indicate those files > are ready for I/O. That may well be the case for regular files. I'm talking in particular about filehandles which ar

Re: [go-nuts] syscall.Read() with timeout: syscall.Select() vs golang's select statement

2016-07-26 Thread Sam Vilain
On 7/24/16 12:49 PM, fabian.stae...@gmail.com wrote: > The idea is obvious: When the timeout is reached, fd is closed, which > interrupts the blocking syscall.Read(), which terminates the goroutine. I'm wondering how to do this safely for filehandles I don't want to close, for instance stdin or st

Re: [go-nuts] What dependency management tool do you use?

2016-07-14 Thread Sam Vilain
On 7/12/16 1:15 PM, Johann Höchtl wrote: > I use godep. There has been lots of rumour lately to use gb. > > What do others use? > > If there is a blog post available somewhere comparing the pros and > cons, please provide one. > I know https://github.com/golang/go/wiki/PackageManagementTools > > I