On Thursday, 20 August 2020 20:28:23 UTC-4, Ian Lance Taylor wrote:
> We’re going to settle on square brackets for the generics syntax.
FWIW, the same square-bracket syntax was used by Barbara Liskov's CLU in
the mid-1970s, and was, as far as I can tell, the first syntax used for
parametric po
On Tuesday, 21 May 2019 01:18:34 UTC-4, Ben Hoyt wrote:
>
> I'm looking at adding a timeout option to my GoAWK script interpreter...
> Are there better / more performant ways to handle this?
>
Hi Ben, imposing resource bounds is a tricky problem. It's possible to do
it in an interpreter impleme
Starlark is the new name for the Skylark configuration language. (The old
name was the code name for a subproject of Bazel and was not suitable for a
project in its own right.)
The Starlark in Go implementation has moved. The code is now hosted at
https://github.com/google/starlark-go
but
On Saturday, 4 November 2017 11:52:05 UTC-4, Keith Brown wrote:
>
> Are there any native golang tools simar to this which work on
> Windows/Linux/OSX?
>
The Skylark interpreter doesn't make any particular assumptions about the
CPU or OS, so it should be highly portable. Please file an issue if
Glad you got things working. A few quick remarks:
1) You don't need to call ParseDir or CreateFromFiles. The loader will
figure out what files you need to load for each package; just call
config.Import(packagename).
2) The go/types tutorial says that export data doesn't contain position
inform
On Friday, 21 April 2017 12:28:25 UTC-4, st ov wrote:
>
> In general, is it advisable to return pointers to newly constructed
> instances when using constructors?
>
> Would it matter more for types that don't have members of composite types
> slice and maps?
> So in the following example, https:
On Tuesday, 21 February 2017 12:23:44 UTC-5, Arpit Aggarwal wrote:
>
> I am doing a project in which I need Go compiler's intermediate
> representation(IR) (which is semantics preserving and I can get all all
> info like line number and data type and other features) (human readable) to
> convert
On Tuesday, 31 January 2017 00:15:40 UTC-5, Keiji Yoshida wrote:
>
> Hi,
>
> "Declaring Empty Slices" of CodeReviewComments (
> https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
> ) says as below:
>
> ```
> When declaring a slice, use
>
> var t []string
>
> rather than
>
On Sunday, 1 January 2017 06:43:32 UTC-5, josvazg wrote:
> I am trying to come up with a detailed definition of what a thread safe Go
> program is (and is not). One that a (go) tool could check by analyzing the
> code for me.
>
You've set yourself an impossible task. A function is thread-safe
On Friday, 20 January 2017 14:11:37 UTC-5, mhh...@gmail.com wrote:
>
> Hi,
>
> How would i revert an ast.Decl (import, var, ect)
> to the file path declaring it ?
>
> Looks like ast.File does not remember its path,
> https://golang.org/pkg/go/ast/#File
>
>
The parser stores in the FileSet a mappin
On Friday, 23 December 2016 14:01:15 UTC-5, mhh...@gmail.com wrote:
>
> Hi,
>
> i m looking for the right way to load and parse an ast.ImportSpec
> referenced into an ast.File object.
>
> Its mostly about the path resolution, I can t find a method like
>
> parse(baseDir string, pkgPath string)...
On Tuesday, 20 December 2016 00:31:52 UTC-5, Ian Lance Taylor wrote:
>
> [Go] is designed to let you control when and
> how memory is allocated, giving you control over when memory is
> allocated. The effect is that in Go you can adjust your program to
> reduce GC overhead, rather than tuning t
On Monday, 19 December 2016 06:52:40 UTC-5, Jason E. Aten wrote:
>
> In the context of having a REPL for Go (and the new plugin support!) where
> we would generate functions at runtime, I'm curious if the garbage
> collector could be made to scan (perhaps on cue) some designated sub-space
> for
On Friday, 16 December 2016 06:22:47 UTC-5, Jan Mercl wrote:
>
> > but I am curious: why the need for internal/gc, "a Go compiler front
> end. Work in progess" ?
> > it seems to be very much alike to go/types (or, rather, a mix of
> go/types and go/ast).
>
> For example (not completely fair compa
On Tuesday, 13 December 2016 20:06:49 UTC-5, Dave Cheney wrote:
>
> I advice caution, Go is not Java and does not permit circular
> dependencies. The more packages you have, the greater the chance you have
> of creating a circular dependency.
>
That's a rather dark viewpoint. Absent further inf
On Tuesday, 13 December 2016 11:34:24 UTC-5, Jan Mercl wrote:
>
> On Tue, Dec 13, 2016 at 5:19 PM Manlio Perillo > wrote:
>
> > However I think that there is no reason why a "main" package should not
> be importable, to the point that
> > I think that the fact that a "main" package is not importa
On Tuesday, 13 December 2016 08:58:00 UTC-5, jis...@hifx.co.in wrote:
>
>
>
> http://stackoverflow.com/questions/41121448/code-base-refactoring-tool-for-go-move-files-from-packages-to-sub-packages
>
> Currently my code-base have just 1 level of packages , due to the increase
> in number of compone
On Monday, 12 December 2016 12:22:51 UTC-5, Jan Mercl wrote:
>
> On Mon, Dec 12, 2016 at 6:20 PM > wrote:
>
> > I realize that obviously the Go compiler does it, I was wondering if
> there is a good API for that I can use, like the ast package?
>
> See https://golang.org/pkg/go/types/
>
You can u
On Tuesday, 29 November 2016 13:10:49 UTC-5, Ian Lance Taylor wrote:
>
> On Tue, Nov 29, 2016 at 9:51 AM, Roger Alsing > wrote:
> > Coming from C++/C# background where locks/mutexes are considered evil
> due to
> > blocking threads.
> > Due to how the Go goroutine scheduler works, are the Go c
>
> On Wednesday, 30 November 2016 03:37:55 UTC+2, Mandolyte wrote:
>>
>> I have a fairly large 2D slice of strings, about 115M rows. These are
>> (parent, child) pairs that, processed recursively, form a tree. I am
>> "materializing" all possible trees as well as determining for each root
>> n
On Wednesday, 30 November 2016 05:13:15 UTC-5, akshans...@gmail.com wrote:
>
> Thanks a lot for your valuable suggestions. I think the one using SSA form
> will be helpful for my project.
>
Lest there be any confusion: there are two unrelated SSA forms for Go code,
the one used internally by th
On Monday, 28 November 2016 09:04:55 UTC-5, atd...@gmail.com wrote:
>
>
> I concur.
>
> On Monday, November 28, 2016 at 4:35:13 AM UTC+1, Michael Jones wrote:
>>
>> Details of this would make a great Go Blog post…
>>
>
There is certainly a dearth of documentation on how to make the key design
If you're building tools for source code analysis, you may find the
golang.org/x/go/ssa representation easier to work with than the internals
of the compiler. Build and run this command to see an example:
$ go get golang.org/x/tools/cmd/ssadump
$ ssadump -build=F fmt
Alternatively, the cmd
On Friday, 18 November 2016 10:30:45 UTC-5, Ian Lance Taylor wrote:
>
> I think the book is trying to stress that it declares out but does not
> declare err. I agree that the sentence seems to imply that it does
> not assign a value to out, but in fact it does both declare out and
> assign a va
On Thursday, 10 November 2016 04:09:29 UTC-5, James Pettyjohn wrote:
>
> I ran into this on go 1.6.2 amd64, seems unlikely this is a core issue and
> I need to look else where in the project but has anyone seen this before?
>
> fatal error: concurrent map read and map write
>
> goroutine 21619 [ru
On Monday, 7 November 2016 19:54:35 UTC-5, Mandolyte wrote:
>
> Thanks for the quick response. and for your book - one of the best I've
> ever purchased!
>
Thanks! Glad it was helpful.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubs
On Monday, 7 November 2016 17:55:57 UTC-5, Kaylen Wheeler wrote:
>
> I'm trying to find a typesafe way to access a type-indexed map of
> components. This map can contain objects of any type, and the keys are
> reflect.Type.
>
> One strategy I thought may work would be to pass a pointer to a poin
On Monday, 7 November 2016 16:57:29 UTC-5, Mandolyte wrote:
>
> I have what amounts to a recursion problem and I wrote a minimal test
> using go routines. I am able to vary the max number of go routines as a
> parameter on the command line (*). But the times don't vary much whether a
> single go
On Friday, 4 November 2016 22:49:17 UTC-4, Nate Finch wrote:
>
> If the script you run with go run returns a non-zero exit status, go run
> prints "exit status N" and itself then returns with exit code 1.
>
> Now, this seems like a double mistake - first off, the only time go run
> should print a
On Thursday, 3 November 2016 23:54:46 UTC-4, 刘桂祥 wrote:
>
> sorry could you provide a complete example ?
>
> I try this but not find question
> package main
>
>
> import "time"
>
>
> type T struct{ x int }
>
>
> var global *T
>
>
> func f() {
> p := new(T)
> p.x = 1
> global = p // "publish" th
On Thursday, 3 November 2016 03:05:47 UTC-4, 刘桂祥 wrote:
>
>
> package main
>
> import "time"
>
> func main() {
> s := []int{100, 200}
> println(&s)
> go func() {
> s[0] = 300
> s = []int{300, 400}
> }()
> time.Sleep(1 * time.Second)
> }
>
> just curious about this ,can you help explain the assemb
On Wednesday, 2 November 2016 11:24:38 UTC-4, Martin Steffen wrote:
>
> I meant more: the _terminology_ of being untyped may reflect an internal
> treatment of how the go compiler treats
> those things: inside the go-compiler, the ``static phase''/type
> checker/type inferencer may treat
> for i
On Sunday, 23 October 2016 16:17:29 UTC-4, John Souvestre wrote:
>
> Take a look at https://github.com/LK4D4/trylock/blob/master/trylock.go .
>
>
>
> I believe that it is easier and performs better.
>
Yes, this looks like a sound solution if you don't need the re-entrant
behavior.
--
You rece
On Friday, 21 October 2016 09:05:10 UTC-4, Michael Liu wrote:
>
> I've a race scenario used with Mutex.Lock with Lock() and Unlock(). now
> multi-routines try to lock the resource and start a few logical code if the
> Lock.Lock() succesfully. other routines don't need to block util
> Lock.Unlock
On Wednesday, 19 October 2016 16:50:55 UTC-4, Thomas Bushnell, BSG wrote:
>
> On Wed, Oct 19, 2016 at 1:47 PM Pietro Gagliardi > wrote:
>
>> Manual memory management is a part of life in the C world. defer is the
>> solution that Go comes up with to situations where explicit cleanup is
>> necess
On Wednesday, 19 October 2016 06:33:09 UTC-4, Jan Mercl wrote:
>
> On Wed, Oct 19, 2016 at 12:27 PM T L >
> wrote:
>
> Nothing. The language specification does not mention it.
>
> People use that term based on definitions specified for other programming
> languages, but those are not always equal
On Tuesday, 18 October 2016 15:30:36 UTC-4, Joshua Liebow-Feeser wrote:
>
> are there any bits in a pointer which, when modified, won't mess with the
> GC?
>
Even if there are, using them would constrain the future choices of the GC
team, for which they will not thank you.
This seems like a bad
On Monday, 17 October 2016 10:10:47 UTC-4, Sokolov Yura wrote:
>
> Mutex needs not to be type-safe.
> And Mutex is not part of concept of "language tailored towards
> concurrency".
>
Go does not take a strong Erlang-like stance against concurrency with
shared variables, so mutexes really are cr
On Monday, 17 October 2016 09:15:33 UTC-4, Axel Wagner wrote:
>
> However, the compiler might be clever enough to optimize that out with
> inlining and escape analysis. And indeed, I'm failing to trigger the
> behavior with any simple testcase. So I might be wrong here. Would be
> interested in
On Sunday, 16 October 2016 08:40:32 UTC-4, Sokolov Yura wrote:
>
> "future" is commonly used synchronization abstraction.
>
> It could be implemented in a library, using mutex, channel and interface.
> Example:
> https://github.com/Workiva/go-datastructures/blob/master/futures/selectable.go
>
>
Yes, the memory representation of the zero value of any type consists only
of zero bytes.
However, this is an implementation detail and not a consequence of the spec.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group
On Tuesday, 4 October 2016 13:32:03 UTC-4, Ahmed (OneOfOne) W. wrote:
>
> Some of our code uses something like:
>
> type Dummy struct {
> closed int64
> }
>
> func(d *Dummy) IsClosed() bool {
> return atomic.LoadInt64(&d.closed) == 1
> }
>
> func(d *Dummy) Close() error {
> if !atomic.CompareAndSwa
On Friday, 16 September 2016 06:43:38 UTC-4, Jan Mercl wrote:
>
> Which rule selects the first parse? Can anybody please enlighten me?
> Thanks in advance.
>
The grammar is indeed ambiguous, but the ambiguity is (implicitly) resolved
by favoring the leftmost derivation, which is what you get fro
On Monday, 12 September 2016 12:04:30 UTC-4, sqweek E. wrote:
>
> Yes, through plain assignment. What problems arise from that?
>
Here's the general form of the problem. In the code below, one goroutine
(f) creates a variable, initializes it (x=1), then shares its address with
another goroutine
On Monday, 12 September 2016 08:57:15 UTC-4, Markus Zimmermann wrote:
>
> Hi gophers!
>
> I am wondering why we have a "declared and not used" compile error for
> variables [https://play.golang.org/p/KLzHVO5L7q] but not for constants [
> https://play.golang.org/p/JG9dSa_VKg]? I am sure there is so
On Friday, 2 September 2016 09:51:52 UTC-4, Kevin Conway wrote:
>
> Given a type T that implements interfaces A1 and A2, T is an acceptable
> input for any function that requires an A1 or A2 as input. Given A1 and A2
> are identical in definition, the return value of a function that returns an
>
On Thursday, 1 September 2016 07:12:59 UTC-4, Aram Hăvărneanu wrote:
>
> On Wed, Aug 31, 2016 at 11:58 PM, adonovan via golang-nuts
> > wrote:
> >
> > [the POSIX 'select' system call] was the inspiration for the Go
> > select statement, but
On Wednesday, 31 August 2016 07:48:12 UTC-4, Dave Cheney wrote:
>
> Unfortunately POSIX does not guarantee that close from one thread will
> unblock another.
To read from a file without waiting longer than a specified time, you need
to use the POSIX 'select' system call, which you can find at
On Monday, 29 August 2016 23:30:48 UTC-4, chri...@uber.com wrote:
>
> I am reading a file line by line, and send it to a chan []byte, and
> consume it on another goroutine.
>
> However, I found I must create a new []byte, because the scanner.Bytes()
> returned a []byte slice that's shared, and th
On Monday, 29 August 2016 13:36:00 UTC-4, Conrad Irwin wrote:
>
> because of the automatic escape detection, I no longer think of a pointer
> as being the intrinsic address of a value; rather in my mind the & operator
> creates a new pointer value that when dereferenced returns the value.
>
>
On Friday, 26 August 2016 23:58:53 UTC-4, T L wrote:
>
> And there is also an exception for the counter rule: map elements are not
> addressable.
>
Just because you can use the assignment syntax m[k]=v to update a map
element does not mean a map element is a variable ("addressable"). This is
n
On Friday, 26 August 2016 06:02:56 UTC-4, Peng Gao wrote:
>
> I am doing a bench for my map-based cache.
>
> the get implementation is the same
> // Get an item from the cache. Returns the item or nil, and a bool
> indicating
> // whether the key was found.
> func (c *cache) Get(k string) (interfa
On Monday, 22 August 2016 11:51:59 UTC-4, JC wrote:
>
> Given:
>
> func main() {
> r := 'a'
> s := "a"
> fmt.Println(r)
> fmt.Println(s)
> }
>
> My very possibly incorrect understanding is that the rune r holds a
> Unicode code-point encoded with UTF-8 and stored as integer value, in this
> case
On Wednesday, 17 August 2016 12:00:46 UTC-4, HWJ wrote:
>
> TL;DR: what's the best way to do SSA back-translation when using
> x/tools/go/ssa?
>
> I'm thinking about a Go compiler which accepts a subset of Go and emits
> assembly for a microcontroller. Instead of going all the way from
> lexing
On Monday, 1 August 2016 17:53:59 UTC+1, T L wrote:
>
>
> ex:
>
> package main
>>
>> func main() {
>> // error: illegal constant expression: *int == interface {}
>> _ = (*int)(nil) == interface{}(nil)
>> }
>
>
This is a compiler bug (https://github.com/golang/go/issues/16702). Thanks
fo
On Saturday, 13 August 2016 22:27:42 UTC+1, Paul Jolly wrote:
>
> On Saturday, 13 August 2016 21:58:37 UTC+1, Paul Jolly wrote:
>>
>> Am I missing something obvious here?
>>
>
> Please excuse the reply to self, but I have discovered what I was missing.
>
> For the sake of completeness, here is how
The Oracle tool is deprecated and I will delete it in October.
Please use the Guru tool instead: https://golang.org/s/using-guru
thanks
alan
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails
On Saturday, 16 July 2016 05:31:41 UTC-4, Jan Mercl wrote:
>
> On Sat, Jul 16, 2016 at 10:39 AM T L >
> wrote:
>
> > I know this result, but I just need the reason, not the result.
>
> The method set distinction of T vs *T allows to forbid calling methods
> intended to mutate the receiver (ie. re
On Friday, 24 June 2016 03:10:56 UTC-4, Oleg Puchinin wrote:
>
> Hello !
> Where I can find subject ?
>
Hi Oleg,
our book The Go Programming Language (gopl.io) is now available in Russian,
thanks to Williams Press:
http://www.williamspublishing.com/Books/978-5-8459-2051-5.html
The ozon.ru site
On Thursday, 23 June 2016 20:27:21 UTC-4, Nick Pavlica wrote:
>
> While learning Go from the book "The Go Programming Language", by
> Addison-Wesley I was working through an example and was taken back by how
> easy it is to cause a data race.
>
I'm glad you appreciated this risk, but I hope it d
On Friday, 17 June 2016 15:21:55 UTC-4, Joshua Liebow-Feeser wrote:
>
> Hi All,
>
> I'm trying to use the go/* packages to parse and type check Go source
> code. I've downloaded github.com/coreos/etcd to test this on, and I'm
> currently trying it out in the etcdserver subdirectory. When I run 'g
On Thursday, 16 June 2016 18:00:43 UTC-4, Zauberkraut wrote:
>
> would an extended usage of this paradigm be considered unidiomatic in Go?
>
Short answer: yes. Excessive use of function values as arguments and
results of other functions can make the flow of control hard to follow.
--
You recei
62 matches
Mail list logo