Re: [go-nuts] GC Internals Questions

2017-12-20 Thread Jan Mercl
On Wed, Dec 20, 2017 at 12:57 AM 'Keith Randall' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Pointers that point from a Go object to somewhere outside the Go heap are perfectly fine. Can you please specify the exact mechanism used by the runtime to determine "is outside the Go heap"?

Re: [go-nuts] GC Internals Questions

2017-12-19 Thread Jan Mercl
On Tue, Dec 19, 2017 at 1:50 PM Xuanyi Chew wrote: > As such I have no idea what would happen if the GC scanner hits a unsafe.Pointer that it cannot access. Will the pointer be marked as unaccessible? Does it panic with SIGBUS? I think the GC will not try to dereference a pointer that is known t

Re: [go-nuts] Compiler Static Optimisation

2017-12-19 Thread Jan Mercl
On Tue, Dec 19, 2017 at 12:05 PM Chris Hopkins wrote: ... > was slower than: ... Without more information the conclusion that the optimization is not there cannot be established. Inspect the real produced machine code. I guess you'll find that the machine code differs in cache-line alignment o

Re: [go-nuts] Github wiki pages publicly editable

2017-12-14 Thread Jan Mercl
On Thu, Dec 14, 2017 at 5:05 PM Ivan Borshukov wrote: > I've noticed that I'm able to edit the wiki pages on https://github.com/golang/go/wiki and I wonder whether this is intentional. IINM, it's like that from the beginning of the Github repository, so probably intentional. -- -j -- You re

Re: [go-nuts] go generate ignores files ignored for build

2017-12-14 Thread Jan Mercl
On Thu, Dec 14, 2017 at 11:53 AM dc0d wrote: > What is the reasoning for not executing //go:generate ... comments inside a file, that is excluded from build by // +build ignore? 'ignore' is just a tag like any other: $ cat main.go // +build ignore //go:generate echo foo package main func mai

Re: [go-nuts] Re: Learning Go: suggestions for code review?

2017-12-14 Thread Jan Mercl
On Thu, Dec 14, 2017 at 6:27 AM Nigel Tao wrote: > As per https://golang.org/doc/effective_go.html#mixed-caps ALL_CAPS > names are unusual Go style. They are, but token names are often/traditionally all caps and underscores: https://golang.org/pkg/go/token/#Token - in the old lex style. And it h

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Jan Mercl
On Wed, Dec 13, 2017 at 1:20 PM wrote: > Could you first answer this question? The problem is that so far no one seems to be able to understand some/most of your questions. Please try asking using more words of explanation. The added context may hopefully help others to reconstruct the meaning.

Re: [go-nuts] Unused Variable Generates No Error

2017-12-13 Thread Jan Mercl
On Wed, Dec 13, 2017 at 10:04 AM dc0d wrote: > This code compiles and generates no errors. Why? It's legal code according to the language specification. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

Re: [go-nuts] ABout the note of slice tricks on Go github wiki

2017-12-12 Thread Jan Mercl
On Tue, Dec 12, 2017 at 3:39 PM T L wrote: > Does it still valid for the latest gc? > In other words, does gc 1.9 still check the segment [len(s), cap[s]) of a slice s to find active pointers? It's not an option, the garbage collector must always scan the whole backing array. -- -j -- You

Re: [go-nuts] Is the result right or not?

2017-12-06 Thread Jan Mercl
On Wed, Dec 6, 2017 at 3:46 PM Jan Mercl <0xj...@gmail.com> wrote: On Wed, Dec 6, 2017 at 3:41 PM T L wrote: > It would be helpful if you state where do you see the problem so others do not have to guess. My apologies, you _have_ stated where do you see the problem. -- -j -- You

Re: [go-nuts] Is the result right or not?

2017-12-06 Thread Jan Mercl
On Wed, Dec 6, 2017 at 3:41 PM T L wrote: > ok, I get it. But how about this: It would be helpful if you state where do you see the problem so others do not have to guess. Anyway, the behavior is correct. The loop equals to // initially {3, 5, 7} x[2] = x[0] // {3, 5, 3} x[2] = x[1] // {3

Re: [go-nuts] why fmt "%#v" and "%#q" of string value have different result

2017-12-06 Thread Jan Mercl
On Wed, Dec 6, 2017 at 11:36 AM Ally Dale wrote: > I was confused that why fmt "%#v" and "%#q" of string value have different result. See: https://golang.org/pkg/fmt/#hdr-Printing The default format for %v is: bool:%t int, int8 etc.: %d uint, uint8 etc.:

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Jan Mercl
On Mon, Dec 4, 2017 at 1:57 PM wrote: > i should have mentioned the race detector found nothing. jan, can you give an example of a go program > setting a pointer to -1 without using unsafe? this requires the gc to have free'd something that is still live, > doesn't it? See https://research.swtch

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Jan Mercl
If course it can. On Mon, Dec 4, 2017, 07:46 wrote: > a program not using unsafe cannot set a pointer to -1, even if there is a > race, right? > > - erik > > > On Sunday, December 3, 2017 at 10:20:44 PM UTC-8, Jan Mercl wrote: > >> On Mon, Dec 4, 2017 at 7:03 AM w

Re: [go-nuts] corrupt stack?

2017-12-03 Thread Jan Mercl
On Mon, Dec 4, 2017 at 7:03 AM wrote: > does anyone have any idea what's going on here, or some hints on debugging this? What does the race detector say? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

Re: [go-nuts] Elphaba Chess

2017-12-02 Thread Jan Mercl
On Sat, Dec 2, 2017, 20:38 wrote: > > Google is not going to be happy if somebody uses Go to compete against > Google. > This is where I stopped considering any of your future posts worth my attention. Disclaimer: I'm not affiliated with Google in any way except programming in Go. -- -j --

Re: [go-nuts] Sort a huge slice of data around 2GB

2017-11-29 Thread Jan Mercl
On Wed, Nov 29, 2017 at 3:19 PM Subramanian K wrote: > To run 2GB of data it takes really long time, I am trying to split these to buckets and make it run concurrently, finally need to collate results of all these small sorted buckets. Have you measured and detected where the bottleneck is? If i

Re: [go-nuts] Reading os.Stdin, Unbuffered

2017-11-27 Thread Jan Mercl
On Mon, Nov 27, 2017 at 4:00 PM dc0d wrote: > Is there a way to read from `os.Stdin` in an unbuffered way? (Not waiting for a `\n` or anything). n, err := os.Stdin.Read(buf) does not wait for `\n`. Or do you actually mean setting a terminal in raw mode? Because os.Stdin does not have to

Re: [go-nuts] Re: Interface value terminology

2017-11-27 Thread Jan Mercl
On Mon, Nov 27, 2017 at 3:18 PM Stefan Nilsson wrote: > I fully understand that this can be implemented in many different ways. That's not my question. Splitting words about "consists of" and "has a" doesn't add much to the discussion. I think the distinction is essential. Consider/compare to:

Re: [go-nuts] Re: Interface value terminology

2017-11-27 Thread Jan Mercl
On Mon, Nov 27, 2017 at 3:02 PM Stefan Nilsson wrote: > Sure, using a type descriptor to implement the dynamic type is an implementation detail. but the fact that an interface value consists of a concrete value and a dynamic type is part of the spec. The value of an interface variable does not c

Re: [go-nuts] Re: Interface value terminology

2017-11-27 Thread Jan Mercl
On Mon, Nov 27, 2017 at 2:43 PM Stefan Nilsson wrote: Having a dynamic type does not imply having a/any type descriptor included in the value of an interface variable. That's why it's an implementation detail. -- -j -- You received this message because you are subscribed to the Google Grou

Re: [go-nuts] Interface value terminology

2017-11-27 Thread Jan Mercl
On Mon, Nov 27, 2017 at 9:13 AM Stefan Nilsson wrote: > My question. How do you refer to the following three concepts (and why): > > 1. the value of an interface (both parts), The value of/in the interface variable. Why: No alternative comes to my mind. > 2. the concrete value, The value of/in

Re: [go-nuts] Does uintptr count as a refence?

2017-11-26 Thread Jan Mercl
On Sun, Nov 26, 2017 at 6:20 PM wrote: > The core question is does a uintptr derived from a pointer to an object count as a reference as far as GC is concerned? Within a single expression yes, otherwise no. -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Beginner Question About Structure Initialization

2017-11-22 Thread Jan Mercl
On Wed, Nov 22, 2017 at 7:03 PM wrote: > ./bad.go:12:18: syntax error: unexpected newline, expecting comma or } Fixed: https://play.golang.org/p/fk_fopK6V1 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] is this safe?

2017-11-21 Thread Jan Mercl
On Tue, Nov 21, 2017 at 7:51 PM DV wrote: > I think that's a horrible idea in any language, honestly. You shouldn't be mutating the thing you're enumerating. Go specs, for example, take care to guarantee it's safe in at least some, if not all cases. Pruning eg. a map would otherwise incur a full

Re: [go-nuts] stucked in the interface mud

2017-11-21 Thread Jan Mercl
On Tue, Nov 21, 2017 at 2:40 PM wrote: https://play.golang.org/p/InPAO_haLU works, but I don't think it's what you're after, because once more types implement Compare this approach gets dirty with type too many type switches. -- -j -- You received this message because you are subscribed to

Re: [go-nuts] is this safe?

2017-11-20 Thread Jan Mercl
On Mon, Nov 20, 2017 at 5:48 PM Trig wrote: > Is using append this way (to remove an index), inside of the range loop of the same array I'm working with, safe... since the size of myList is being changed within it? It's safe as it will not crash your program. It's unsafe as it's a quadratic algo

Re: [go-nuts] Oracle

2017-11-18 Thread Jan Mercl
On Sat, Nov 18, 2017 at 5:09 PM wrote: > First, let me thank the person who has written the Oracle (oci8) package for Go (preferred over the other Oracle package). > However, it seems difficult to install, on Windows at least. Google-ing for help did not give a solution. I am less than 7 hours ol

Re: [go-nuts] How to optimize?

2017-11-15 Thread Jan Mercl
On Wed, Nov 15, 2017 at 8:45 PM Christian LeMoussel wrote: > Why not but I don't understand. Neither do I understand, unfortunately. Additionally, the unreadable, low-contrast picture is, well, unreadable for me. Link to the playground version is perfect. Plain, black on white text without any

Re: [go-nuts] How to optimize?

2017-11-15 Thread Jan Mercl
On Wed, Nov 15, 2017 at 6:15 PM Christian LeMoussel wrote: > I have this program (https://play.golang.org/p/qHPzjj2uj3) that take a decent amount of time for computing. Don't know where to start. Maybe this one: It passes ~1GB of data by value on the stack for no reason. (Unless the compiler is

Re: [go-nuts] Re: How can I convert an byte array into int array?

2017-11-12 Thread Jan Mercl
On Sun, Nov 12, 2017 at 2:41 PM Christian LeMoussel wrote: > byte array come from GPU card. > Why this question? See https://commandcenter.blogspot.de/2012/04/byte-order-fallacy.html -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Golang capacity

2017-11-12 Thread Jan Mercl
On Sun, Nov 12, 2017 at 12:00 PM wrote: > The question is capacity. > Why not : 0,1,2,3,4,5 as length ? Because O(n) is better than O(n^2). -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiv

Re: [go-nuts] Re: How can I convert an byte array into int array?

2017-11-12 Thread Jan Mercl
On Sun, Nov 12, 2017 at 11:48 AM Christian LeMoussel wrote: > To detect byte order for golang, I find this package GoEndian Where does the byte array come from? Depending on that information you may find you don't need to know the byte order at all. -- -j

Re: [go-nuts] How can I convert an byte array into int array?

2017-11-12 Thread Jan Mercl
On Sun, Nov 12, 2017 at 10:37 AM Christian LeMoussel wrote: > I have []byte, How can I convert this to []int? What encoding is used for those integers? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group an

Re: [go-nuts] NaN as key in map

2017-11-10 Thread Jan Mercl
On Fri, Nov 10, 2017 at 11:24 PM Stefan Nilsson < trolleriprofess...@gmail.com> wrote: > What's your thoughts on this? Not mine, but recommended reading: https://research.swtch.com/randhash -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" grou

Re: [go-nuts] Not getting correct results with sort.Slice().

2017-11-09 Thread Jan Mercl
On Thu, Nov 9, 2017 at 1:17 PM gaurav wrote: > I must be missing something basic here: a simple usage of sort.Slice is not sorting the slice correctly for me. I must be missing something very basic here; could someone please check this out? The less test is perfomed on the ratings slice, but the

Re: [go-nuts] Re: Zero-dependency, small codebase logger which supports StackDriver (Kubernetes) logging.

2017-11-08 Thread Jan Mercl
On Wed, Nov 8, 2017 at 3:15 PM Sotirios Mantziaris wrote: > BSD 3-clause? This might be a problem for some. Why so? Which license would be better? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and sto

Re: [go-nuts] Re: How to check if a request was cancelled

2017-11-08 Thread Jan Mercl
On Wed, Nov 8, 2017 at 1:12 PM Glen Huang wrote: see https://play.golang.org/p/wMJ5PX1x9H -- -j -- 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 golang-nuts+u

Re: [go-nuts] Converting uint to string

2017-11-05 Thread Jan Mercl
On Sun, Nov 5, 2017 at 10:09 PM Chun Zhang wrote: > I have a group of integers ranging from 1 to 2^32 that are in the format of uint32. Assuming you mean 'to 2^32-1'. > However, I am wondering if I use string(i) only, will I get any two numbers the same string representation? My guess is no, bu

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Jan Mercl
ght direction as I was at a > loss for where to even start as the visual cue of `type A B` vs `type A > struct {B}` didn't register wrt the desired error for me. > > On Sun, Nov 5, 2017 at 10:09 AM Jan Mercl <0xj...@gmail.com> wrote: > >> I don't know w

Re: [go-nuts] who does go compiler link executable to glibc without an apparent reason?

2017-11-05 Thread Jan Mercl
Using some of the net/... package calls libc unless disabled. On Sun, Nov 5, 2017, 17:13 Howard Guo wrote: > Hello fellow gophers. > > I've a small number of go programs that only use standard library > functions without any 3rd party library dependency. A strange behaviour was > observed during

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-05 Thread Jan Mercl
t; composite literals and avoiding ambiguity in conversions while "shortest" >> yields no results and the only recollection of "shortest path wins" phrase >> I have is back when vendor directory was introduced. >> >> On Fri, Nov 3, 2017 at 5:11 PM Jan Mer

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-05 Thread Jan Mercl
On Sun, Nov 5, 2017 at 3:16 AM Ben Hoyt wrote: > Hence the confusion. Sure, append can write to the underlying array because that's effectively passed by reference. But it can't update the length of the slice itself, unless you return it. I don't follow. It had been shown, that the result of app

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-04 Thread Jan Mercl
On Sat, Nov 4, 2017 at 1:53 PM Ben Hoyt wrote: > It seems to me that the reasons given for why you need to use the return value of append() are confusing and not quite right. For example, at https://blog.golang.org/slices#TOC_9. Rob Pike says: > > "In this case it's especially important to return

Re: [go-nuts] Expected ambigiuous reference error, got a value instead

2017-11-03 Thread Jan Mercl
On Fri, Nov 3, 2017 at 11:04 PM Daniel Skinner wrote: > https://play.golang.org/p/Y1UxMgNhWx > > I ran into this today but don't understand why the compiler isn't throwing an ambiguous reference error. Maybe I've misunderstood why this error is thrown the few times I've seen it. No ambiguity her

Re: [go-nuts] is this code thread safety?

2017-11-02 Thread Jan Mercl
On Thu, Nov 2, 2017 at 6:54 AM sheepbao wrote: > the close function is thread safety? how about call `closed` at the same time. I don't know, but you might want to reconsider posting text with contrast going in some places below 10% (guestimated), to possibly get answers from people which refuse

Re: [go-nuts] mutual exclusion algorithm of Dijkstra - strange behaviour

2017-10-30 Thread Jan Mercl
On Mon, Oct 30, 2017 at 6:29 PM wrote: > I noticed a very strange effect by translating the > mutual exclusion algorithm of E. W. Dijkstra to Go. For every combination of lines A/B present/not present, the program has data races, so there's nothing to reason about. You can try it by yourself by

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-27 Thread Jan Mercl
On Fri, Oct 27, 2017 at 10:21 PM T L wrote: > A better example to show the inhomogeneity of the selected possibilities of each case. Those stats can be exact only for infinite populations. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" grou

Re: [go-nuts] Re: get the data out of slice of structs

2017-10-26 Thread Jan Mercl
On Thu, Oct 26, 2017 at 12:25 PM Vikram Rawat wrote: > ... my problem is that there are no slice of time.Time. var foo []time.Time // is a slice of time.Time In general, []T is a slice of T. T can by any named type, local or imported or it can be a type literal, like in []struct{i int}, which i

Re: [go-nuts] Re: get the data out of slice of structs

2017-10-26 Thread Jan Mercl
On Thu, Oct 26, 2017 at 11:39 AM Vikram Rawat wrote: > How do a get a slice of DState from got this is my question var a []string for _, v := range got[1:3] { a = append(a, v.DState) } -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Re: [golang-dev] Subject: Go 1.9.2 and Go 1.8.5 are released

2017-10-26 Thread Jan Mercl
On Thu, Oct 26, 2017 at 1:51 AM Chris Broadfoot wrote: > We have just released Go versions 1.9.2 and 1.8.5, minor point releases. FYI: All Go1.9.2 milestone issues are open ATM. -- -j -- You received this message because you are subscribed t

Re: [go-nuts] a bug about go language

2017-10-23 Thread Jan Mercl
On Mon, Oct 23, 2017 at 5:23 PM <2891132l...@gmail.com> wrote: what bug do you see and where? -- -j -- 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 golang-nu

Re: [go-nuts] will the following code always print two 1?

2017-10-22 Thread Jan Mercl
On Sun, Oct 22, 2017 at 9:19 AM T L wrote: > why? The OP code with line numbes: https://play.golang.org/p/4fmiWqDDc1 The main goroutine busy loops at lines 15-20. Because of that the goroutine at line 10 may never run and thus line 17 may never get executed. If so, line 18 and thus also lines 2

Re: [go-nuts] will the following code always print two 1?

2017-10-21 Thread Jan Mercl
On Sat, Oct 21, 2017 at 11:01 PM T L wrote: > fmt.Println(a) // always print 1? Possibly. But the statement may never execute. > //== > fmt.Println(x) // always print 1? Same answer. -- -j -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] slice of pointer of struct vs slice of struct

2017-10-20 Thread Jan Mercl
On Fri, Oct 20, 2017 at 11:07 AM Bakul Shah wrote: > On the flip side, []*T will be less cache/TLB/GC friendly than > []T, unless T is much larger than a ptr. You are also > allocating an extra pointer per element. For small slices it > probably doesn't matter much either way but when slices hold

Re: [go-nuts] slice of pointer of struct vs slice of struct

2017-10-20 Thread Jan Mercl
On Fri, Oct 20, 2017 at 10:39 AM Ian Davis wrote: > How does that affect the size of []T or []*T ? No one said it does. What size of T affects is appending/inserting/deleting items to/from the slice. If one passes around a value of type []T, those operations are probably performed on the value.

Re: [go-nuts] A full-feature serialization package to replace std.binary released.

2017-10-20 Thread Jan Mercl
On Fri, Oct 20, 2017 at 9:37 AM Ally Dale wrote: FTR: OP probably means encoding/binary where std.binary is written instead for unknown reasons. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop re

Re: [go-nuts] slice of pointer of struct vs slice of struct

2017-10-19 Thread Jan Mercl
On Fri, Oct 20, 2017 at 7:25 AM Feby Tanzil wrote: > Which is better & preferable in Go? Depends on size of T. -- -j -- 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 e

Re: [go-nuts] Is iota increment behavior implemented here?

2017-10-15 Thread Jan Mercl
On Sun, Oct 15, 2017 at 8:59 PM wrote: > I'm writing an article about iota and I've found that its counting behavior is implemented in the below source code? Am I right, if not, where it is? Can you help me? > > https://github.com/golang/go/blob/90d71fe99e21b68e292327c966946f1706d66514/src/cmd/co

Re: [go-nuts] How to generate long int with k random bits.

2017-10-13 Thread Jan Mercl
> On Fri, Oct 13, 2017 at 4:37 PM Christian LeMoussel wrote: See https://golang.org/pkg/math/big/#Int.Rand -- -j -- 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

Re: [go-nuts] Why go does't have NullInt type on database/sql?

2017-10-12 Thread Jan Mercl
On Thu, Oct 12, 2017 at 2:38 AM 高橋誠二 wrote: > There are NullInt64 and NullFloat64, but not about NullInt, NullFloat. (or NullInt32 etc...) > After scanning from rds, my team always convert them to int, but it seems so silly. That does not work accross architectures. > What is the reason? The d

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 11:34 AM Ian Davis wrote: > At first glance this looks like a bug in strings.Replacer. What bug do you mean? https://play.golang.org/p/0DBwWt2TU9 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe f

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 10:58 AM Gianguido Sorà wrote: WAI: "\x32" == "2" -- -j -- 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 golang-nuts+unsubscr...@goo

Re: [go-nuts] Re: important

2017-10-09 Thread Jan Mercl
On Mon, Oct 9, 2017 at 7:04 PM Francisco Dalla Rosa Soares < dallar...@gmail.com> wrote: > Actually I have the email here from three days ago, so it might have been marked as spam at some inboxes No such message in my spam folder (using inbox.google.com). -- -j -- You received this message b

Re: [go-nuts] Re: important

2017-10-09 Thread Jan Mercl
On Mon, Oct 9, 2017 at 6:43 PM Ian Lance Taylor wrote: > Didn't I answer this question already? Obviously you did, I can see your answer in the web interface, but if the OP is using only the mail for communicating with the group, as I do, I must say that your answer never made it to my inbox and

Re: [go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Jan Mercl
On Sun, Oct 8, 2017 at 8:02 PM Zack Scholl wrote: > Why does it slow down the code if its not inlined? Since the method is on a pointer struct I assume it wouldn't need to copy anything? Call/return is not free even before stack limit checking, pushing the arguments and retrieving the return val

Re: [go-nuts] [ANN] 99c

2017-10-07 Thread Jan Mercl
> Is there any desire to support c11? > On Sat, Oct 7, 2017 at 1:01 PM Jan Mercl <0xj...@gmail.com> wrote: > >> Command 99c is a c99 compiler targeting a virtual machine: >> https://github.com/cznic/99c >> >> >> >> -- >> >> -j >

[go-nuts] [ANN] 99c

2017-10-07 Thread Jan Mercl
Command 99c is a c99 compiler targeting a virtual machine: https://github.com/cznic/99c -- -j -- 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 golang-nuts+uns

Re: [go-nuts] binary.Read()

2017-10-07 Thread Jan Mercl
On Sat, Oct 7, 2017 at 8:48 PM Johan terryn wrote: > If I declare "in" as var of type os.File before the call to binary.read(...) > I get a compile error stating that in is not a reader, without the declaration it works fine... > just odd unexpected behavior. Why not just show the failing code?

Re: [go-nuts] binary.Read()

2017-10-05 Thread Jan Mercl
On Thu, Oct 5, 2017 at 9:10 PM Johan terryn wrote: > Here is the full (trimmed) working program: The program compiles just fine (https://play.golang.org/p/Xg3qlovrzg), where is the problem? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" gro

Re: [go-nuts] binary.Read()

2017-10-05 Thread Jan Mercl
On Thu, Oct 5, 2017 at 5:22 PM Johan terryn wrote: > Or is this working as intended? Hard to tell w/o a complete, self contained reproduction program. But note that os.File is not an io.Reader, *os.File is. -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] installing the rename tool

2017-10-05 Thread Jan Mercl
On Thu, Oct 5, 2017 at 5:22 PM sparc1998 wrote: > I tried to install go's rename tool using go get golang.org/x/tools/refactor/rename. This installed some related files in ~/go/src and ~/go/pkg, but it didn't install a new tool in ~/go/bin, and I'm wondering why? Because its a package. Use $ go

Re: [go-nuts] Errors out of syscall

2017-10-02 Thread Jan Mercl
On Mon, Oct 2, 2017 at 2:51 PM Chris Hopkins wrote: > Yes, it has dynamic type. That doesn't mean you can't test against it. > I thought the preferred way to to handle errors was for a package to expert the error variables, then you could test for those variables as in the above code. The code s

Re: [go-nuts] Errors out of syscall

2017-10-02 Thread Jan Mercl
On Mon, Oct 2, 2017 at 2:19 PM Chris Hopkins wrote: I'm not sure I understand: error is an interface and it always has some dynamic type when non-nil. But that type cannot by string b/c string does not implement the error interface. -- -j -- You received this message because you are subscrib

Re: [go-nuts] Defer with anon func and func literal

2017-09-28 Thread Jan Mercl
On Thu, Sep 28, 2017 at 2:50 PM Karan Chaudhary wrote: > I'm trying to find rationale for this: why is "defer foo(x)" treated differently than "defer func() { foo(x) }" by the language designers? They are not treated differently. The defered functions are different. -- -j -- You received t

Re: [go-nuts] Defer with anon func and func literal

2017-09-28 Thread Jan Mercl
On Thu, Sep 28, 2017 at 2:18 PM Karan Chaudhary wrote: That's expected, the specs say that execution of the defer statement evaluates the arguments of the deferred function. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscrib

Re: [go-nuts] Graphing libraries in golang

2017-09-28 Thread Jan Mercl
On Wed, Sep 27, 2017 at 5:05 PM Vikram Rawat wrote: Also there's https://github.com/cznic/plot. -- -j -- 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 golang-

Re: [go-nuts] Example output not visible in godoc

2017-09-25 Thread Jan Mercl
On Mon, Sep 25, 2017 at 10:55 AM snmed wrote: > Has anyone an idea why it is no working correct? Blind shot: Try removing the final empty line: https://bitbucket.org/snmed/sting/src/85748cacc8970f60582428bf05d52fcfb051ba5f/example_inject_test.go?at=master&fileviewer=file-view-default#example_inj

Re: [go-nuts] Tiny FSM

2017-09-24 Thread Jan Mercl
On Sun, Sep 24, 2017 at 11:07 AM dc0d wrote: https://youtu.be/HxaD_trXwRE?t=14m7s -- -j -- 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 golang-nuts+unsubscr.

Re: [go-nuts] Going crazy on golang maps

2017-09-23 Thread Jan Mercl
On Sat, Sep 23, 2017 at 4:37 PM Chris Polderman wrote: > The full code reads: The full code is not full code. It lacks eg. the import declarations. Please provide a link to the really full code at a specific commit for others to reproduce. -- -j -- You received this message because you are

Re: [go-nuts] buffered io.ReaderAt

2017-09-16 Thread Jan Mercl
On Sat, Sep 16, 2017 at 1:52 PM Sebastien Binet wrote: > Has anybody written a buffered version of an io.ReaderAt ? IIUC what's needed, you might want to try https://github.com/cznic/file/blob/efffc965e97bbf31b0ed00deb82fe697500f22b5/file.go#L1039 -- -j -- You received this message because

Re: [go-nuts] Is this a race detector false positive case

2017-09-15 Thread Jan Mercl
On Fri, Sep 15, 2017 at 3:15 PM wrote: https://stackoverflow.com/q/46233680 -- -j -- 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 golang-nuts+unsubscr...@go

Re: [go-nuts] Are you tired typing if err != nil {} ?

2017-09-14 Thread Jan Mercl
On Fri, Sep 15, 2017 at 2:32 AM Wojciech S. Czarnecki wrote: I code a lot in Go, but saving a couple of seconds/minutes when writing code which, including research, thinking, testing, debugging and documenting, takes hours or even months to develop makes no sense to me. Vim is my IDE and I don't

Re: [go-nuts] Possible bug in golang type checker

2017-09-12 Thread Jan Mercl
On Tue, Sep 12, 2017 at 4:19 PM wrote: > Is that a bug in the golang type checker or am i missing something. An instance of A implements A because it _is_ A. C embeds A so C implements A. B embeds *C so B implements A. -- -j -- You received this message because you are subscribed to the Goo

Re: [go-nuts] Testing on Go templates Range's index

2017-09-09 Thread Jan Mercl
On Sat, Sep 9, 2017 at 6:01 PM Tong Sun wrote: As documented , ne is a function, not an infix operator: https://play.golang.org/p/sJSzoNyrJz -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] unicode constant

2017-09-07 Thread Jan Mercl
On Fri, Sep 8, 2017 at 12:09 AM Tong Sun wrote: https://play.golang.org/p/FD8UMrDkf- > How can I make it works? Follow the language specification. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and sto

Re: [go-nuts] Any historical discussion around support "go generate -parallel n"?

2017-08-29 Thread Jan Mercl
go generate "scripts" may fail to work in parallel and people will ask why not, even though they shouldn't have used the -parallel option in those cases in the first place. But /go:generate go run mysafeparallelgen.go can be used today. On Tue, Aug 29, 2017, 07:14 Guanhua Jiang wrote:

Re: [go-nuts] Re: Generics and readability

2017-08-27 Thread Jan Mercl
On Sun, Aug 27, 2017, 18:28 Tristan Colgate wrote: Code generation feels more idiomatic to Go. I'm tempted by some kind of > package level generics, but I'm terrified that the standard library might > end up using them. > Stdlib uses code generation since its first public release in 2009 ;-) --

Re: [go-nuts] Re: Generics and readability

2017-08-27 Thread Jan Mercl
that wasn't quite thought thoroughly. Talking about C++ like it's an > example to follow is just preposterous. > > Le dimanche 27 août 2017 16:25:54 UTC+2, Jan Mercl a écrit : > >> And there's nothing wrong in it. That's how C++ started. Codegen allows >&

Re: [go-nuts] Re: Generics and readability

2017-08-27 Thread Jan Mercl
And there's nothing wrong in it. That's how C++ started. Codegen allows for easier protoyping throwaway experiments. Writing a full blown compiler and realizing afterwards a better language/feature design costs probably much more work. On Sun, Aug 27, 2017, 15:55 wrote: > > Codegen can do 100% o

Re: [go-nuts] Re: Generics and readability

2017-08-27 Thread Jan Mercl
Codegen can do 100% of what any compiler can do. On Sun, Aug 27, 2017, 14:54 wrote: > > A lot of people consider code gen a second class solution when compared > to a more traditional generics implementation. I don't think so. Code > generation can be very effective. No major concerns about inde

Re: [go-nuts] Potential race condition in prototypical network server code

2017-08-24 Thread Jan Mercl
at is not correct? > > Cheers, > Tom > > > On Thursday, August 24, 2017 at 7:56:22 PM UTC+2, Jan Mercl wrote: > >> The wg.Wait will be executed after l.Accept returns an error. It's >> purpose is to wait for the completions of all handlers invoked in the g

Re: [go-nuts] Potential race condition in prototypical network server code

2017-08-24 Thread Jan Mercl
; > In fact, the for {} is an infinite loop so wg.Wait() will never be reached > and serve() will never terminate. Correct? > > I guess I over-read how much this prototypical code was representative of > a real server loop. Sorry Dave! > > Tom > > On Thursday, August 24, 201

Re: [go-nuts] Potential race condition in prototypical network server code

2017-08-24 Thread Jan Mercl
No, wg.Add cannot "switch" to wg.Wait, they're both in the samr goroutine, the go statement will be always the next one to execute after wg.Add within serve(). On Thu, Aug 24, 2017, 19:29 Tom Payne wrote: > I'm not singling out Dave Cheney here, I'd just like to check my > understanding of Go's

Re: [go-nuts] Initializing Go Struct Literals

2017-08-22 Thread Jan Mercl
On Tue, Aug 22, 2017 at 4:38 PM Tong Sun wrote: https://play.golang.org/p/mKdRevvsH0 -- -j -- 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 golang-nuts+unsubs

Re: [go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-22 Thread Jan Mercl
On Tue, Aug 22, 2017 at 3:33 PM roger peppe wrote: > I *think* that the current implementation was inspired by Minux's comment here: > https://groups.google.com/d/msg/golang-dev/G-uGL-jpOFw/vfazKS47_ckJ > > but I can't seem to find a comment from Russ that I seem to remember > where that's specif

Re: [go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-22 Thread Jan Mercl
On Tue, Aug 22, 2017 at 1:35 PM MartinG wrote: > In the below code example, setting a function variable to a simple function makes no memory allocation and is very fast (<1ns). The case of setting the same function variable to a method value is much slower (~30ns) and it turns out to be because

Re: [go-nuts] Gathering Ideas for Go 2.

2017-08-21 Thread Jan Mercl
rse the amount of work for testing certain language features can be > extensive so maybe it is unattainable. > I think the Hotspot teams publish builds at certain steps to try out stuff > (I could be wrong) but of course it is not generally used by most end users. > > > > mån

Re: [go-nuts] Gathering Ideas for Go 2.

2017-08-21 Thread Jan Mercl
On Mon, Aug 21, 2017, 19:32 Michael Jones wrote: > I don't think it's about language. I got downvotes immediately for my > comments over the weekend. > https://github.com/golang/go/issues/19623 > > Whatever the circumstances, any proposal will often have its detractors as > the most immediate and

Re: [go-nuts] Why constant is not addressable in golang?

2017-08-21 Thread Jan Mercl
On Mon, Aug 21, 2017 at 1:46 PM Konstantin Khomoutov wrote: > That is > > const onethird = 1 / 3 > > has greater precision than > > onethird := float64(1) / 3 Zero does not seem to have greater precision than 0. when approximating the real number 1/3. -- -j -- You received t

<    4   5   6   7   8   9   10   11   12   13   >