Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Bakul Shah
On Jun 9, 2019, at 6:14 AM, Michael Ellis wrote: > > I'm not disputing the wisdom of Go's design. As I said at the top of the > initial post, I like Go the way it is and see no need for a Go 2. > > I was trying to find a clean solution to a specific use case: nestable > functions that

[go-nuts] Working with firestore offline

2019-06-09 Thread Hasibul Hasan
Is there any way to mocking firestore? -- 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...@googlegroups.com. To view this discussion on the

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Michael Ellis
I'm not disputing the wisdom of Go's design. As I said at the top of the initial post, I like Go the way it is and see no need for a Go 2. I was trying to find a clean solution to a specific use case: nestable functions that generate html. Since new methods on primitives are not allowed

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Michael Ellis
On Sunday, June 9, 2019 at 9:56:43 AM UTC-4, Bakul Shah wrote: > > > You are almost always going to call a string's Render function > (as you defined it in your original post) from a parent HTMLTree > struct' Render(), almost never in isolation -- except perhaps some > tests. So one

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-09 Thread 'Axel Wagner' via golang-nuts
As I've also mentioned: I don't think this test is meaningful. First, as it has been pointed out, your Perl program isn't actually a web server. It only understands ridiculously simple requests and as such violates the spec left and right. It's also super naive in how it treats malformed input or

[go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-09 Thread Houzuo Guo
Hello fellow gophers. Given a function type: type Fun func() And two structure methods that satisfy the function type: type Alpha struct { } func (a Alpha) funA() { } type Beta struct { } func (b Beta) funB() { } At runtime, is there a way to tell whether a non-nil `var f Fun` is assigned to

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Bakul Shah
On Jun 9, 2019, at 7:42 AM, Michael Ellis wrote: > > On Sunday, June 9, 2019 at 9:56:43 AM UTC-4, Bakul Shah wrote: > > You are almost always going to call a string's Render function > (as you defined it in your original post) from a parent HTMLTree > struct' Render(), almost never in

[go-nuts] bogus "missing return at end of function"

2019-06-09 Thread Marvin Renich
Is it already a known issue that a «for [true] { ... }» loop whose only exit path is through return statements inside the loop (i.e. no break statement) will produce the compiler error "missing return at end of function" if you don't put a meaningless "return ..." statement after the loop? If

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Steven Blenkinsop
> > If one library defines string.Render() for html, and another defines > another string.Render() for, say, a graphics library, which Render will be > called when I call "str".Render()? Method call syntax is the least of the worries. Presumably, that could be based on which packages are

[go-nuts] Re: A good indicator of code quality

2019-06-09 Thread Carl
I agree with you. The reason for point 2 is to ask the question if it is possible at all. In theory, a successful implementation would not affect a good coder, but would provide pointers to a less than competent one. The assumption is that they learn over time. To be clear, this is in addition

Re: [go-nuts] bogus "missing return at end of function"

2019-06-09 Thread Marvin Renich
* Marvin Renich [190609 20:40]: > Is it already a known issue that a «for [true] { ... }» loop whose only > exit path is through return statements inside the loop (i.e. no break > statement) will produce the compiler error "missing return at end of > function" if you don't put a meaningless

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Burak Serdar
On Sun, Jun 9, 2019 at 8:42 AM Michael Ellis wrote: > > > > On Sunday, June 9, 2019 at 9:56:43 AM UTC-4, Bakul Shah wrote: >> >> >> You are almost always going to call a string's Render function >> (as you defined it in your original post) from a parent HTMLTree >> struct' Render(), almost never

Re: [go-nuts] Avoid global variables in Http handlers

2019-06-09 Thread sethamclean
You are passing the struct and not the method on the struct to the handle function. -- 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

Re: [go-nuts] Re: Best ORM for Golang and their framework like Revel and Martini

2019-06-09 Thread Andrew Pillar
I made a comment about a similar topic on an HN thread, about ActiveRecord style ORMs in Go. > Personally I think an active record style ORM for Go like gorm is a > poor fit for a language that doesn't come across as inherently OOP. > Going through some of the documentation for gorm, it seems

[go-nuts] Tint: Terminal styling module for Go

2019-06-09 Thread ckrackerx15
Hi, I would like to share with guys a module that I have been developing for the past few months. Its called tint (v0.0.1). It helps you style your terminal output efficiently. Here are some links that can get you started with this module: -

Re: [go-nuts] Re: Best ORM for Golang and their framework like Revel and Martini

2019-06-09 Thread Andrew Pillar
I made a comment about this on an HN thread about ORMs in Go. > Personally I think an active record style ORM for Go like gorm is a poor fit for a language that doesn't come across as inherently OOP. Going through some of the documentation for gorm, it seems to rely heavily on method chaining

Re: [go-nuts] Allow methods on primitives

2019-06-09 Thread Michael Ellis
*type Content = Content_ | string* That's a nice notation (and semantic). It certainly makes sense for this case. Count me as a vote in favor. *“I want you to act as if the house was on fire. Because it is.” — Greta Thunberg* On Sun, Jun 9, 2019 at 1:37 PM Bakul Shah wrote: > On Jun 9,

Re: [go-nuts] bogus "missing return at end of function"

2019-06-09 Thread Michal Strba
Can you post a code (preferably a link to play.golang.org) that does this? I can't reproduce it myself. On Mon, Jun 10, 2019, 02:40 Marvin Renich wrote: > Is it already a known issue that a «for [true] { ... }» loop whose only > exit path is through return statements inside the loop (i.e. no

[go-nuts] go modules:the pkg uses two different module paths

2019-06-09 Thread 唐彦昭
### What version of Go are you using (`go version`)? $ go version go version go1.12.5 linux/amd64 ### Does this issue reproduce with the latest release? Yes ### What operating system and processor architecture are you using (`go env`)? go env Output $ go env GOARCH="amd64" GOBIN=""

Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-09 Thread Houzuo Guo
Thanks very much Ian - indeed I should have proof read the message. With the last paragraph, I wished to ask for a way to tell a non-nil ` var f Fun` is assigned to `funA` of any instance of structure Alpha, or `funB` of any instance of structure Beta - without performing equality comparison

[go-nuts] does any known tool for function (text) inlinig ?

2019-06-09 Thread djadala
Hi, is there any tool for function text (source code) inlinig, to be used with go generate ? thanks in advance. -- 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

[go-nuts] go: how to input two-dimensional string array form keyboard??

2019-06-09 Thread shine sun
Firstly, I try to input N and M from keyboard, creating a two-dimensional string array (var nums [N][M]string). Then, for i := 0; i < N; i++ , how to use fmt.Scanf to input M strings for each nums[i]? Finally, it can successfully output the two-dimensional array nums. Thank you for helping!

Re: [go-nuts] At runtime, is there a way to tell the structure's symbol name, of which a bound method offered a satisfactory implementation of a function type?

2019-06-09 Thread Ian Lance Taylor
On Sun, Jun 9, 2019 at 9:48 AM Houzuo Guo wrote: > > Given a function type: type Fun func() > > And two structure methods that satisfy the function type: > > type Alpha struct { > } > func (a Alpha) funA() { > } > > type Beta struct { > } > func (b Beta) funB() { > } > > At runtime, is there a