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

2019-04-25 Thread Mike Schinkel
Marcus Low wrote: > > datalen := removedKeyken // removedKeyken must have been int32 in your > example. > if value != nil { >datalen = len(value) > } > The issue with this is it makes two assignments when value != nil instead of just one. -- You received this message because you are

Re: [go-nuts] Some questions about go plugin

2019-04-25 Thread Kurtis Rader
On Thu, Apr 25, 2019 at 8:59 PM xu wrote: > I recently built an app using go plugin, but I have some questions about > "plugin cannot be closed", why can't plugin be uninstalled? > Try googling "go plugin unload". The first result for me is https://github.com/golang/go/issues/20461 and there

[go-nuts] Some questions about go plugin

2019-04-25 Thread Tamás Gulácsi
Use something more separated than a dll/so if it changes frequently. For example github.com/hashicorp/go-plugin starts the given executable and communicates with it through a domain socket. That way you can easily restart the plugin as frequently as you wish. -- You received this message

[go-nuts] Some questions about go plugin

2019-04-25 Thread xu
Dear all: I recently built an app using go plugin, but I have some questions about "plugin cannot be closed", why can't plugin be uninstalled? The application I build needs to load and unload the plugin frequently to call the changed external logic (this part of the logic changes frequently).

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

2019-04-25 Thread Henry
I disagree with the suggestion. IF statement indicates a branching of execution path. It should be made to stand out so that when people are skimming through the code can immediately pick up these alternate execution paths. Changing it to a mere "?" will reduce its visibility. You have to

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

2019-04-25 Thread Dan Kortschak
Please understand that my use of ?: in the proposed grammar is irrelevant. Using the syntax proposed here leads to the same problem. You have self contradictory claims below: 1. the change is only a swapping of 'if' => '?' and 'else' => ':' with no semantic change: "My proposal  

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

2019-04-25 Thread Robert Engels
The problem is that Go already has if and else and else if (which would look really weird in your proposal) Changing a word to a symbol does not enhance meaning - it reduces it, and increases the learning curve. Like I said, you will probably like Ada - lots of symbols there. > On Apr 25,

[go-nuts] Re: Gomobile Reverse Bindings: Cannot import any android packages

2019-04-25 Thread kelly . a . campbell
I'm running into an issue with reverse bindings similar to this. My project structure is like: mobile/ └── pkg └── example ├── android │ └── javatest.go └── testmobile.go *testmobile.go:* package example import ( "mobile/pkg/example/android" ) func

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

2019-04-25 Thread lgodio2
To Kortschak and all others participating in this debate : Please don't get hung up over my choice of symbol '?' . My choice of symbol '?' and ';' is causing people to equate my proposal with a proposal to adopt C's ternary operator in Go. This is not what I intended to propose. My proposal

[go-nuts] Re: Gomobile Reverse Bindings: Cannot import any android packages

2019-04-25 Thread Mark Bauermeister
Ok. I fixed it. For anybody interested, here's how I solved it. On the Go side, I extended my exported function by adding "ctx content.Context" as a parameter (i e "func Hello(ctx content.Context). On the Java side, I'm then passing the mobile context as follows (this is a React Native app, so

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

2019-04-25 Thread Tyler Compton
> > There are many counter-examples. What is the likelihood that someone who > is not familiar with the "?" operator will be familiar with the operators > for getting (*) and dereferencing (&) a pointer. And what is "<-"? > Certainly people not familiar with Go will initially be confused by >

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

2019-04-25 Thread Dan Kortschak
The difference is that the ternary operator is an expression and the if...else is a statement. If you're only suggesting a syntax change, then the difference becomes one of readability. I'll ask again, how would you preclude nesting without making the language more complex? On Thu, 2019-04-25 at

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

2019-04-25 Thread lgodio2
Rob: Am I missing something ?? The proposed syntax test ? { } : { } with no-nesting allowed is equivalent to if test { //. } else { // .. } ..The former is just a cleaner way of writing the latter Any complaints regarding 'abuse' associated with the former equally apply to the

[go-nuts] Re: What does "identifier...type" mean in a function definition?

2019-04-25 Thread Andrew Price
Ahh, thanks all, awesome :) On Thursday, April 25, 2019 at 12:35:16 PM UTC-7, Andrew Price wrote: > > Hey folks, > > A colleague wrote this: > > func (l *Logger) log2StdFormatted(level string, msgOrFormatOrArg >> interface{}, args... interface{}) (formatted string) { > > > Note the position of

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

2019-04-25 Thread 'Thomas Bushnell, BSG' via golang-nuts
I'm a big fan of the ternary operator in general. Maybe this is because I'm an old timey Lisper. A lot of the things people see as "abuse" or "too complex" are equally problems with || and &&. This is also true for Jan's point: that ?: affects control flow by omitting execution sometimes. It

Re: [go-nuts] What does "identifier...type" mean in a function definition?

2019-04-25 Thread Marcin Romaszewicz
You have three tokens in "args ... interface{}", (args) (...) (interface{}), the spacing doesn't matter in this case. It's just like in C, you can have int *foo or int* foo. Semantically, the two are the same. -- Marcin On Thu, Apr 25, 2019 at 12:35 PM Andrew Price wrote: > Hey folks, > > A

Re: [go-nuts] What does "identifier...type" mean in a function definition?

2019-04-25 Thread Burak Serdar
On Thu, Apr 25, 2019 at 1:35 PM Andrew Price wrote: > > Hey folks, > > A colleague wrote this: > >> func (l *Logger) log2StdFormatted(level string, msgOrFormatOrArg >> interface{}, args... interface{}) (formatted string) { > > > Note the position of the space *between* the ... and interface{},

Re: [go-nuts] What does "identifier...type" mean in a function definition?

2019-04-25 Thread 'Thomas Bushnell, BSG' via golang-nuts
"..." is called an ellipsis (plural ellipses). The presence or absence of the space is unimportant; you're seeing the way gofmt formats it, but the parser doesn't care. Since period is not a legitimate constituent of an identifier name, they scan in separate tokens either way. On Thu, Apr 25,

[go-nuts] What does "identifier...type" mean in a function definition?

2019-04-25 Thread Andrew Price
Hey folks, A colleague wrote this: func (l *Logger) log2StdFormatted(level string, msgOrFormatOrArg > interface{}, args... interface{}) (formatted string) { Note the position of the space *between* the ... and interface{}, not before the ... [btw does "..." have an easy-to-search-for name?]

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

2019-04-25 Thread Jan Mercl
On Thu, Apr 25, 2019 at 8:58 PM wrote: > > Rob : how can it be abused if the compiler wont allow nested ? operators ?? Rather easily. Just by fuzzilly mixing the otherwise purposely distinct syntax of expressions and control flow. -- You received this message because you are subscribed to the

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

2019-04-25 Thread lgodio2
Rob : how can it be abused if the compiler wont allow nested ? operators ?? On Thursday, April 25, 2019 at 11:47:21 AM UTC-4, Rob 'Commander' Pike wrote: > > 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.

Re: [go-nuts] How many Go compilers are out there?

2019-04-25 Thread Sebastien Binet
On Thu, Apr 25, 2019 at 5:55 PM Ian Lance Taylor wrote: > On Thu, Apr 25, 2019 at 8:29 AM JuciÊ Andrade wrote: > > > > These are the ones I am aware of: > > > > . GC toolchain > > . GCC > > . gopherjs > > > > By Go compiler I mean any tool that understands Go source files and > generates

Re: [go-nuts] Re: Parsing Raw Syslog messages

2019-04-25 Thread Nitish Saboo
Apologies Jake.I am new to this forum.Will try to maintain the decorum from next time. Thanks, Nitish On Thu, Apr 25, 2019 at 10:34 PM wrote: > This group works on a longer timeframe. It is not uncommon for it to take > a day or two to get a good response. Bumping your post 8 hours later is >

Re: [go-nuts] Parsing Raw Syslog messages

2019-04-25 Thread Nitish Saboo
Apologies Jake.I am new to this forum.Will try to maintain the decorum from next time. Thanks, Nitish On Thu, Apr 25, 2019 at 10:35 PM Robert Engels wrote: > That package parses syslog msgs according to rfc3164 so if that works for > you then use it. > > On Apr 25, 2019, at 11:55 AM, Nitish

Re: [go-nuts] Parsing Raw Syslog messages

2019-04-25 Thread Robert Engels
That package parses syslog msgs according to rfc3164 so if that works for you then use it. > On Apr 25, 2019, at 11:55 AM, Nitish Saboo wrote: > > Hi, > > Can someone please guide me on this ? > > Thanks > >> On Thu, Apr 25, 2019 at 2:27 PM Nitish Saboo >> wrote: >> Hi, >> >> I want to

[go-nuts] Re: Parsing Raw Syslog messages

2019-04-25 Thread jake6502
This group works on a longer timeframe. It is not uncommon for it to take a day or two to get a good response. Bumping your post 8 hours later is definitely considered bad etiquette here. On Thursday, April 25, 2019 at 4:57:04 AM UTC-4, Nitish Saboo wrote: > > Hi, > > I want to parse raw

Re: [go-nuts] Parsing Raw Syslog messages

2019-04-25 Thread Nitish Saboo
Hi, Can someone please guide me on this ? Thanks On Thu, Apr 25, 2019 at 2:27 PM Nitish Saboo wrote: > Hi, > > I want to parse raw syslog messages in GO.Similar to glossy npm, which is > a very generic yet powerful library for parsing raw syslog messages, How > can we parse raw syslog

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

2019-04-25 Thread Mark Volkmann
There are many counter-examples. What is the likelihood that someone who is not familiar with the "?" operator will be familiar with the operators for getting (*) and dereferencing (&) a pointer. And what is "<-"? Certainly people not familiar with Go will initially be confused by operators

Re: [go-nuts] How many Go compilers are out there?

2019-04-25 Thread Ian Lance Taylor
On Thu, Apr 25, 2019 at 8:29 AM JuciÊ Andrade wrote: > > These are the ones I am aware of: > > . GC toolchain > . GCC > . gopherjs > > By Go compiler I mean any tool that understands Go source files and generates > executable code. There is also llgo (though I'm not sure if that one still

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

[go-nuts] How many Go compilers are out there?

2019-04-25 Thread JuciÊ Andrade
These are the ones I am aware of: . GC toolchain . GCC . gopherjs By Go compiler I mean any tool that understands Go source files and generates executable code. Thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

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

2019-04-25 Thread ugorji
FYI I recently posted a proposal for some unambiguous syntax which would give a lot of the value of ternary operators i.e. write the 5 line if-else block in the FAQ as a 1-liner, without the drawbacks, while IMO preserving the simplicity of the go language in approachability, readability and

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

2019-04-25 Thread Sam Whited
On Wed, Apr 24, 2019, at 14:08, Mark Volkmann wrote: > Are there really developers that find this unreadable? > > color := temperature > 80 ? “red” : “green” Yes. What is "?"? If I've never seen that before I have no easy way to search for that, and a random symbol me nothing about what it does.

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

2019-04-25 Thread Andrew Klager
> > > Is this so bad? > > Yes, it's horrible as you'll loose any type information you had. > Meaning the next thing you naturally had to do was type cast it, which > isn't the nicest syntax to begin with. > By then it's probably more work than just using if / else > So what you're saying is that

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

2019-04-25 Thread Robert Engels
Go vet doesn’t report on structural issues - and those are far harder to work with/debug than code with the proper use of ternary operators (or even poor use) Bad code is bad code no matter how you get there. On Apr 25, 2019, at 7:05 AM, Lucio wrote: >> >> But don't deny others the ability

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

2019-04-25 Thread Lucio
> > > But don't deny others the ability to choose the first alternative > That's not what's being denied: what is being denied, is the ability to write nested ternaries I then have to debug. Fat lot of good it will do me, that vet reports it to be a misuse. Lucio. -- You received this

[go-nuts] Parsing Raw Syslog messages

2019-04-25 Thread Nitish Saboo
Hi, I want to parse raw syslog messages in GO.Similar to glossy npm, which is a very generic yet powerful library for parsing raw syslog messages, How can we parse raw syslog message in GO ? Can I make use of this link