[go-nuts] Re: Easy to use (getopt based) flags package

2019-04-10 Thread mhhcbon
looks lovely, how do you manage sub commands ? On Wednesday, April 10, 2019 at 2:24:21 AM UTC+2, Paul Borman wrote: > > I have never been quite happy with the flags packages available for Go, > including the standard flags package as well as my own getopt packages (v1 > and v2). They are just t

Re: [go-nuts] Channels: selecting the last element

2018-12-18 Thread mhhcbon
> feel unbuffered channels are safer to use especially in an acyclic directed graph of flowing values. Buffered channels seem to reduce blocking but I feel they come with the cost of such side effects like my initial problem of forgotten results in their channels. that happens with unbuffered

Re: [go-nuts] Important design missing from Errors overview

2018-11-28 Thread mhhcbon
hi, you are looking for this page https://github.com/golang/proposal/blob/master/design/go2draft.md On Wednesday, November 28, 2018 at 9:13:19 AM UTC+1, gopher@gmail.com wrote: > > I do not understand how to respond in the wiki. Do I directly edit the > page? I don't see any comments or dis

Re: [go-nuts] Re: I am not in favor of generics.

2018-09-18 Thread mhhcbon
I was referring to this code func (x type []K) Sum() (r type K) { for type switch { case K range int64(), uint64(), float64(), complex128(): for _, v := range x { r += v } case K big.Int: for _, v := range x { r.Add(r,v) } break //

Re: [go-nuts] Re: I am not in favor of generics.

2018-09-18 Thread mhhcbon
I agree with Robert, this is not re usable. I much prefer this func Sum(some []K, add func(l,r K) K) (ret K) { for _, v := range some { ret = add(ret, v) } return ret } func main(){ total := Sum([]int{1,2,3,4}, func(l,r int) int {return l+r}) } On Tuesday, September 18, 2018 at 5

[go-nuts] public interface with private method: totally dubious ? In which case is it useful ?

2017-09-04 Thread mhhcbon
hi, in this code https://github.com/conformal/gotk3/blob/7a6ce3ecbc883d4d6a7aa1821bbc9633751fd67e/gtk/gtk.go#L7926 a public interface with a private method is declared. At first read, totally dubious. yeah? A bit more testing, and i wonder in which case this is suitable, a basic example yield

[go-nuts] Re: go1.9: problem with go get

2017-08-31 Thread mhhcbon
can this thread helps ? https://groups.google.com/forum/#!topic/golang-nuts/wAYxijyyL5U On Thursday, August 31, 2017 at 10:23:07 PM UTC+2, abriese wrote: > > ~/Download/ $ go build github.com/AndreasBriese/breeze > # runtime > /usr/local/go/src/runtime/mstkbar.go:151:10: debug.gcstackbarrieroff

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

2017-08-27 Thread mhhcbon
in my concern i could agree with everyone. so it does not go anywhere, does it ? Axel resumes it well. I d just add one notion, complexity to build the desired generator. Even though a great work has been made so golang compile in go, it is not an easy api to handle. So if go intends to reac

[go-nuts] Re: Generics and readability

2017-08-26 Thread mhhcbon
simplicity is complicated: https://www.youtube.com/watch?v=rFejpH_tAHM needlessly complex: https://youtu.be/IRTfhkiAqPw?t=19m40s because i liked it very much: https://www.youtube.com/watch?v=QM1iUe6IofM About code gen, as we know it in go1, i feel like it is a third class citizen. In its current

[go-nuts] Re: can't use text filename on open that was read from stdin

2017-08-25 Thread mhhcbon
someone did answer you in your earlier thread, but here you go https://play.golang.org/p/VVTXPhSYPE On Friday, August 25, 2017 at 9:18:18 PM UTC+2, Geoff Fridd wrote: > > When I use a literal as the filename in an os.Open statement it works. > When I use a variable defined as text as the file

Re: [go-nuts] Help! Same code, different results

2017-08-25 Thread mhhcbon
[mh-cbon@pc2 rendez-vous] $ cd ../../go-dedup/fsimilar/ [mh-cbon@pc2 fsimilar] $ find test/sim -type f | ./fsimilar -i -d 12 -vv [fsimilar] n='GNU - 2001 - Python Standard Library', e='.pdf', s='1', d= 'test/sim/' [fsimilar] +: Simhash of 55d4263ae1a6e6d6 added. [fsimilar] n='(eBook) GNU - Python

[go-nuts] https://golang.org/pkg/builtin/#append

2017-08-25 Thread mhhcbon
looks broken here __ File builtin builtin /src/builtin/builtin.go:88:11: expected type, found '=' (and 1 more errors) -- 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

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

2017-08-25 Thread mhhcbon
mh, what do you think of this quote ? Not to reject the whole work, just an example i stumble upon. ___ Note that type deduction requires types to be identical. This is stronger than the usual requirement when calling a function, namely that the types are assignable.

[go-nuts] Re: Generics and readability

2017-08-25 Thread mhhcbon
In first example Value can not do Less, its Entry, Entry has not been defined yet, its nothing. Unless you introduce a Lesser interface and specify Node<$Entry:Lesser> Given that specific example this notation looks pretty heavy, and even worse if d that be As this is all scoped into a type def

[go-nuts] Re: Generics and readability

2017-08-24 Thread mhhcbon
Why would you put generics on a method ? The syntax you demonstrate is horrible, indeed. what if generics are type related type notFinal struct { p1 p2 } func (n notFinal) whatever(in ) string { return fmt.Sprintf(in) // anything to interface{}, works. } type Final notFinal Final.w

[go-nuts] Re: Simple url shortener service

2017-08-24 Thread mhhcbon
hi and welcome! At first, it looks like you did not use a *go aware IDE*. Despite its apparent simplicity, the go language uses a lot of tooling to achieve the goal of ~~quality~~. https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins https://github.com/golang/go/wiki/CodeTools You might wa

[go-nuts] Re: Next generation code generator for go

2017-08-23 Thread mhhcbon
coolest repo to watch at that moment On Wednesday, August 23, 2017 at 9:38:42 AM UTC+2, Walter Schulze wrote: > > I created gogoprotobuf, but I wanted to create a new code generator for go > that does not only work for protocol buffers, but for all go types. > > Here is my next generation code ge

[go-nuts] Re: Go one-line installer

2017-08-02 Thread mhhcbon
Hi, As you at this kind of work, have you considered a reliable one-liner to install dependencies ? I got that own, just today, from a gae repo (?), anyways here it is, go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v golang-sam

[go-nuts] Re: Generics are overrated.

2017-07-30 Thread mhhcbon
"This thread was about concerns that generics would divide Go community" that d would dismiss any attempt to propose generics *because* it s generics, instead of the observation that the proposal does breaks everything including the community. maybe the first thing to do is to ban this word "ge

[go-nuts] Re: Generics are overrated.

2017-07-30 Thread mhhcbon
i have not read this, 1. i do go because the type system is helping me, if i do js, i have no type system, so i have to figure this out by myself, its hard if i d be doing java, i d end up with complex giant scaled type hierarchy, both cases, it d more a difficulty than an helper to my attempt

[go-nuts] pointer lifetime management ?

2017-07-28 Thread mhhcbon
Hi, in this silly code, with a very naive main, which i think is a small representation of some situations we might face irl on larger code base. https://play.golang.org/p/qv5ymHDzr2 Lets say the story of this code is, at first we needed to store values, then we discovered an allocation issue,

[go-nuts] Re: Proposal: Blank types instead of Generics for Go 2

2017-07-23 Thread mhhcbon
if we could have a list of use case, written in g1, with an explanation about why it can t be generalized, we could check any proposal that at first it answers them, then enter into more detailed study and proposals ? I m reluctant to provide examples about concurrency, i have some ideas of wh

Re: [go-nuts] "interface{} says nothing", lets consider it destroys information

2017-07-21 Thread mhhcbon
here is a solution to what i described in previous. The result of func mustNotErr(f func() (, error)) func() () {} is the transitivity of t -to> func (...) (..., *-*error) mustNotErr takes in input a func T with any inputs, and a *traling* error, returns in output, the func T *less* the trailing

Re: [go-nuts] "interface{} says nothing", lets consider it destroys information

2017-07-21 Thread mhhcbon
so wise! thanks for those clarification. I did not deeply understand why it is called an identity func, and why it has to be this signature. It seems so narrowed to a specific case, makes me unhappy. Now, i realized that even if , for some specific cases, seems to solve some situations, it won

[go-nuts] Re: "interface{} says nothing", lets consider it destroys information

2017-07-20 Thread mhhcbon
In func Foo(value T)T { /.../ } It makes sense to anchor the definition of T to the func name. I feel like it is not needed, and i wonder about multiple T parameters. Where the question here is about func Foo(x , y ) (, ){} Or func Foo(x t, y u) (t, u){} At least, it is possible to say your v

[go-nuts] Re: "interface{} says nothing", lets consider it destroys information

2017-07-19 Thread mhhcbon
...I have not been able to find it meaningful elsewhere. sorry, i forgot, - ultimately, type D struct {r}, does not make sense either imo. On Thursday, July 20, 2017 at 6:21:21 AM UTC+2, mhh...@gmail.com wrote: > > I think your example is not relevant, as it clearly intend to change the > in

[go-nuts] Re: "interface{} says nothing", lets consider it destroys information

2017-07-19 Thread mhhcbon
I think your example is not relevant, as it clearly intend to change the input type, the goal is to preserve it, while still working with its value. interface{} value type destroys the input type information, so you might have the opposite value type, a type that preserves. A type that let you

[go-nuts] "interface{} says nothing", lets consider it destroys information

2017-07-17 Thread mhhcbon
in func do(i interface{}) interface{} (return i), do says nothing because "interface{} says nothing", from the caller pov, it looses information at the return call, var x = "o" do(x) // <- return lost the track it was a string if you delegate that func to another func, it can t says anything

[go-nuts] Re: Pure go based Automated Browser simulation without any driver

2017-07-12 Thread mhhcbon
chromedp seems lovely. https://www.youtube.com/watch?v=_7pWCg94sKw On Thursday, July 13, 2017 at 2:48:54 AM UTC+2, Tong Sun wrote: > > I bumped into a pure go based tools that can be used as an automated > Browser simulation, just like Selenium but *without any driver* > selenium-webdriver/Phan

[go-nuts] Re: justforfunc: a Go YouTube series

2017-07-11 Thread mhhcbon
yes that s right, a good back to basics. But not only, it also make sense of TeeReader (https://golang.org/pkg/io/#TeeReader). Also, i wanted to comment afterward that none of fmt.Fprintf(os.Stderr / log.PrintF are perfect. Using fmt, its laboriously long to write, using log.Printf, it might no

[go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-06-19 Thread mhhcbon
hi, I understand what / why you came to that given your explanation, but I disagrees a lot to it. I don t feel like expanding code helps to better explain the how/what/why of a sudden 42 question ? (why this /whatever/ has failed, I believe it should not) I m pretty sure its a good way to mult

[go-nuts] Re: go get in parallel

2017-06-05 Thread mhhcbon
hi, in immediate terms, assuming you have something like go get a go get b go get c Can this https://github.com/mh-cbon/cct#usage be of help ? I did not tested, but it should be, cct -add -timeout 20 go get a cct -a 1 go get b ... cct -wait 1 I m sorry it looks likes i have not implemented e

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
generics, quick sorter, i agree to say its fallacies you can provide one func to quicksort string or Vegetables{}. in my understanding you are doing a quickSorter of Values you can compare. quicksort([]Valuer) type Valuer interface { Value() int } So what s a Valuer when you intent to quickso

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
still because its a lot of fun, testing reader / writer, https://play.golang.org/p/6TBnlY3h6L On Saturday, June 3, 2017 at 6:24:31 PM UTC+2, mhh...@gmail.com wrote: > > for the fun, with early return, > > https://play.golang.org/p/I9AORKOYQm > > On Saturday, June 3, 2017 at 12:34:15 PM UTC+2, mh

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
On Sunday, June 4, 2017 at 6:25:17 PM UTC+2, Egon wrote: > > I think you are missing the point of my comment. > > I'm all for generics, but I also can survive without them without much of > a problem. (I'm even maintaining > https://docs.google.com/document/d/1vrAy9gMpMoS3uaVphB32uVXX4pi-HnNjkM

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
just to add, https://www.youtube.com/watch?v=gHCtEjzZ-rY I could not agree more on the end, i could argue about some arguments ;) btw, is there a channel that gathers all talks about go ? https://www.youtube.com/channel/UCO3LEtymiLrgvpb59cNsb8A https://www.youtube.com/channel/UCSRhwaM00ay0fasnsw

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
as anyway the thread has completely derived, its the right place to put about that. I recently read about stanford choosing to use JS over Java for some its courses. https://www.theregister.co.uk/2017/04/24/stanford_tests_javascript_in_place_of_java/ I can t understand. If a beginner ask me which

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-05 Thread mhhcbon
I want to emphases that go generate is so far an awesome solution, but not a definitive answer. Yes, it could made easier, about that, its already great that all the tools we need are written in go itself, this is really really really helpful. On Monday, June 5, 2017 at 5:59:46 AM UTC+2, utyug

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-04 Thread mhhcbon
given the fact that actually everybody disagrees on that idea, or even something similar according to some feedback. I want to put the question differently. My mean is to say that golang is a basis to build upon in general that is better than other existing solutions. imho, golang is governed

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-04 Thread mhhcbon
I feel much better with this, than its counter part, but what s the point, this is so much about a personal opinion. func (p PackageInfo) DeepEmbeddeds(structName string) (ret StringSlice) { strut := p.GetStruct(structName) if strut.GetName() == structName { e := strut.Embeddeds()

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-03 Thread mhhcbon
for the fun, with early return, https://play.golang.org/p/I9AORKOYQm On Saturday, June 3, 2017 at 12:34:15 PM UTC+2, mhh...@gmail.com wrote: > > > Generics enable more than just replacing loops. For example, they can > enable libraries of generic algorithms to be used with any type of array. >

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-03 Thread mhhcbon
> Generics enable more than just replacing loops. For example, they can enable libraries of generic algorithms to be used with any type of array. Here's an example: in my demonstration every type got this kind of method, the problem become how do you jump from Type A to type B. in []A to []B or

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-03 Thread mhhcbon
Hi, yes generics / not generics. That is, in what i proposed, only the consumer is enhanced, thus generics are not required anymore on the declarer, except for this conv method, indeed. also as the declarer can rely on more powerful tool on the consumer, it needs to declare less to able more.

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-03 Thread mhhcbon
yes true. I m not sure i intend to change that asap, but this another topic, i want not deep into right now. That being said again agreed, understood, prone to happen, maybe. On Friday, June 2, 2017 at 12:05:52 PM UTC+2, Egon wrote: > > On Friday, 2 June 2017 12:06:54 UTC+3, mhh...@gmail.com wr

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-02 Thread mhhcbon
Sorry for this crime of thought, i was thinking it was a chance to talk about it and explore different paths. That, this, is the only answer, well, life is hard. Just for the records, i did stop thinking like that when i started golang, its not like you are given the choice. Psst ... I must ask

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-01 Thread mhhcbon
What d be awesome is that the stream like interface i have bee thinking about provides a convert method, so it can answer to this question given []string how to move on to []int, or, []stream.Map(...) -> give me the length of each string So if the interface contains a magic signature like this,

[go-nuts] Re: To panic or not to panic, that's the question

2017-06-01 Thread mhhcbon
understood the same, was going to give same example. panic at init is ok to me while it look likes a compile error a system requirement error On Wednesday, May 31, 2017 at 9:41:37 PM UTC+2, Pierre Durand wrote: > > I use these functions in init(): > https://golang.org/pkg/html/template/#Must >

[go-nuts] Re: did anyone tried // template exec ?

2017-06-01 Thread mhhcbon
I see, interesting, thanks for that. Note, those are different problems. One is about trying to cheaply speed up template execution by //, I still wonder if that can be worthy, i foresee with the future translation package it might because of the additional call costs, but you know side effects,

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-30 Thread mhhcbon
one more case where conv d be awesome, with fnUtils.InputParams() ParamSlice Where ParamSlice []struct{Name,Type string} With little help, I can do stuff like ctxFilter := astutil.FilterParamSlice.ByType(ctxCtx) fnUtils.InputParams().Filter(ctxFilter).Map(func(p astu

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-30 Thread mhhcbon
I just realized what d be awesome is that the language does not only provide boiler plate []basicType enhanced types, but provides streamed version of them, that d be much better. when you do [15Million]string.map().filter().count(). with a naive implementation over array of those intents, you

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-30 Thread mhhcbon
I m just gonna add more examples as it come, from hasPrefix := func(prefix string) func(string) bool { return func(s string) bool { return strings.HasPrefix(s, prefix) } } // this is not cool if fnUtils.AllTypes().Filter(hasPrefix("post")).

[go-nuts] Re: did anyone tried // template exec ?

2017-05-30 Thread mhhcbon
thanks for feedback. > If you need parallel execution of those function calls, I would run the calls as part of my Go code and then pass the results to the template. This is not really //. You are still waiting for the input to exist before you even start the template processing. If you put t

[go-nuts] Re: did anyone tried // template exec ?

2017-05-30 Thread mhhcbon
obviously not, go func t.Exec... go func t.Exec... but ` {{slowcall}} {{fastcall}} {{slowcall}} {{$y := CanNot//}} ` ect On Tuesday, May 30, 2017 at 10:09:35 AM UTC+2, mhh...@gmail.com wrote: > > hi, > > wonder, if anyone, > - tried to make an implementation of template that works in // ? > - w

[go-nuts] did anyone tried // template exec ?

2017-05-30 Thread mhhcbon
hi, wonder, if anyone, - tried to make an implementation of template that works in // ? - was it successful ? - useful for perf ? thanks -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fr

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-26 Thread mhhcbon
oops... mistake in it. printS, err := conv(func(s string, err error), fmt.Println) or panic(err) _, err := []string{"hello}.Map(strings. ToUpper).MustEach(printS) or panic(err) count, err := conv(func(s string) n int, fmt.Println) or panic(err) n := []string{"hello}.Map(strings.ToUpper).Sum(coun

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-26 Thread mhhcbon
or this, printS, err := conv(func(s string, err error), fmt.Println) or panic(err) _, err := []string{"hello}.Map(strings.ToUpper).MustEach(printS) or panic(err) count, err := conv(func(n int), fmt.Println) or panic(err) n := []string{"hello}.Map(strings.ToUpper).Sum(count) count, err := conv(f

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-26 Thread mhhcbon
for the fun, I want to write []string{"hello}.Map(strings.ToUpper).Each(fmt.Println) would not work, func param are incompatible. let s apply static rules to convert it, printS, err := conv(func(s string), fmt.Println) or panic(err) []string{"hello}.Map(strings.ToUpper).Each(printS) Now it s

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-26 Thread mhhcbon
as i m on it, please consider, what below code might be with little imagination, // Create a new Tomate func (t Controller) Create(postColor *string) (jsonResBody *Tomate, err error) { mustNot(postColor, nil) or return ... &UserInputError{errors.New("Missing color parameter")} co

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-26 Thread mhhcbon
would not it be nice to write []string{"hello}.Map(strings.ToUpper) ? And so for userland types the language accept, []*MyType.Filter(func(*MyType)*MyType).Map(...).First()//etc. IRL, because the total lack of such struct in the language might let you think the idea is superfluous with the cur

[go-nuts] Re: bash completion for flag package

2017-05-25 Thread mhhcbon
worked like a charm since i understood i needed to source my bashrc! great package here! thanks a lot! On Tuesday, May 23, 2017 at 9:21:07 PM UTC+2, Eyal Posener wrote: > > I recently did the complete package , > that enables bash completion for the go comman

[go-nuts] Re: bash completion for flag package

2017-05-24 Thread mhhcbon
wahou :) trying it now! On Tuesday, May 23, 2017 at 9:21:07 PM UTC+2, Eyal Posener wrote: > > I recently did the complete package , > that enables bash completion for the go command line. > I came to be really satisfied with the result, but the package downsid

[go-nuts] idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-05-24 Thread mhhcbon
see the title, only for what s needed Slice/Splice/Each/Map/First/Last/Reverse/Sort ect ect not len, for reason. so interface system serves the userland by its definition of struct, and the basic slice type provided by the language is fully operational, without breaking, btw. i don t go further

[go-nuts] Re: [go/loader] write a conf to load faster a program ?

2017-05-17 Thread mhhcbon
Do you think i could take advantage of importer to serialize stdlib, then unserialize it rather than process it every times ? Are those types linked to some sort of unserializable resource that would prevent that to happen ? On Tuesday, May 16, 2017 at 1:43:44 AM UTC+2, mhh...@gmail.com wrote:

[go-nuts] The zero value of a slice is nil

2017-05-17 Thread mhhcbon
hi At https://blog.golang.org/go-slices-usage-and-internals#TOC_3. It says, > The zero value of a slice is nil. The len and cap functions will both return 0 for a nil slice. Then looked at https://youtu.be/ynoY2xz-F8s?t=10m20s I found the second explanation much better to explain https://

[go-nuts] Re: [ANN] Ugarit

2017-05-17 Thread mhhcbon
hi there, On Tuesday, May 16, 2017 at 12:28:37 PM UTC+2, Luis Furquim wrote: > > > > Em segunda-feira, 15 de maio de 2017 09:30:20 UTC-3, mhh...@gmail.com > escreveu: >> >> On the code itself, >> i suspect you don t know yet about *go fmt*, >> I strongly suggest you to use it, >> just because its

[go-nuts] Re: Stop HTTP Server with Context cancel

2017-05-17 Thread mhhcbon
> Is it OK to use context cancellation for stopping long running functions ? yes, i d say so. About contexts, https://www.youtube.com/watch?v=LSzR0VEraWw https://www.youtube.com/watch?v=8M90t0KvEDY >From scratch, with some mocks to test&try. package main import ( "context" "log"

[go-nuts] [go/loader] write a conf to load faster a program ?

2017-05-15 Thread mhhcbon
Hi, I wrote this func to load a program, its faster but it has drawbacks about error managements. It might hide some messages. the first time i ran this function, without a special typechecker error handler, I felt overwhelmed by the amount of errors generated. in this func s is an import path,

Re: [go-nuts] Re: adding context.Context to new code

2017-05-15 Thread mhhcbon
+1 for any feedback. > One issue was libraries that were used both in paths from http requests (so they needed the context propagated through them) but were also used in places where their callers (starting at main) didn't have any contexts at all yup. Imagine also in the middle of the call y

[go-nuts] Re: [ANN] Ugarit

2017-05-15 Thread mhhcbon
HI, some feedback, So this package generates epub files ? In versions 20 / 30 ? Is it correct ? Can you add an example to use it ? Small one. My very personal taste, I love useful READMEs. On the code itself, i suspect you don t know yet about *go fmt*, I strongly suggest you to use it, just b

[go-nuts] Re: New fully featured bash completion for go - written in go

2017-05-14 Thread mhhcbon
looks awesome!! In this, https://github.com/posener/complete/blob/master/example/self/main.go Just wonder why i can t simply do something similar to, var name string whatever.StringVar(&name, "name", "", "Give your name", complete. PredictAnything) if whatever.Run() { return } Anyway, great s

Re: [go-nuts] Re: adding context.Context to new code

2017-05-13 Thread mhhcbon
A reference i found about "reactive programming" https://github.com/dsyer/reactive-notes/blob/master/intro.adoc Hope this introduced the concept correctly, thanks for pointing that. Following are only some thoughts, Two things surprising here, 1/ a programmer prefers not to solve a problem 2/ on

[go-nuts] Re: why received can be defined with/without pointer?

2017-05-11 Thread mhhcbon
One more try : ) > I think what you're saying is that it's more natural and obvious that when > you have a function that changes something it would be more obvious and > simple if it actually did modify the thing you gave it. > That the receiver always act as a ref to a value stored /wherever

[go-nuts] Re: why received can be defined with/without pointer?

2017-05-11 Thread mhhcbon
I honestly don t know. Seems my example is OK for you, i really thought it was demonstrative of some confusion, seems not. If i m correct in following your understanding and comparisons, in those two cases, x := valueType{} > x.SetName("yo!") > fmt.Println(x.Name) > > y := &valu

Re: [go-nuts] Re: adding context.Context to new code

2017-05-11 Thread mhhcbon
thanks, ..integrating Context into the runtime.. 50% runtime, 50% syntax with explicit contextualization. ..The flow of request processing in Go may include multiple goroutines and may move across channels; yes big ? mark here. might the 50% of an handy and explicit syntax help with it? C+

[go-nuts] Re: why received can be defined with/without pointer?

2017-05-11 Thread mhhcbon
Hi, thanks again! I m not the one to validate a perfect answer, i can simply tell that from my go learning and understanding, i agree top notch 200% no question there on this description, which is weird in fact. I d only remark about this, > so there are actually just two cases: Method is on po

[go-nuts] Re: why received can be defined with/without pointer?

2017-05-11 Thread mhhcbon
to be honest, i m killed because i agree 100% with that explanation. I friendly scratch my head too because i m less interested by the implementation than by the packaging you put on it, and the effects that it produces on the end user, if i can say so. In that regards the explanation you gave

[go-nuts] Re: why received can be defined with/without pointer?

2017-05-11 Thread mhhcbon
yeah i totally admit i don t master the subject at all, and i would prefer not have to talk about heap/stack thing, by incidence what, still, bugs me is on the intersection of many topics which make it difficult to talk about. thanks again for your attempts even though i lost you and, i guess, h

[go-nuts] Re: [ANN] scaffolder - web application servers to order

2017-05-11 Thread mhhcbon
It s awesome, in my opinion, this is the way i want to consume go in the future. pragmatic, correct, fast, repeatable. in additions to what go provides, fast build, cross platform, easy to package Although, my very personal opinion, lets do smaller program that combines together, in the spirit

Re: [go-nuts] Re: adding context.Context to new code

2017-05-11 Thread mhhcbon
Thanks a lot! Might i guess and try to generalize your explanations into "we tried to write a plumber for all cases possible" Which matters a lot, in my humble opinion. At least for the various reasons you put there, simply put, because it seems not technically achievable. Still i m happy you g

Re: [go-nuts] Re: adding context.Context to new code

2017-05-09 Thread mhhcbon
> I've done a limited form of this using awk ;-) if you have a minute, can you tell more about what limited you in your attempts and which trade made you stop (guessing), if any ? Do you still think it be awesome ? Or have you made your mind to an opposite position ? if so, For which reasons

Re: [go-nuts] Re: use of builtin print for debug

2017-05-09 Thread mhhcbon
On Tuesday, May 9, 2017 at 2:46:03 PM UTC+2, Marvin Renich wrote: > > [I set an explicit Reply-To header because I do not want duplicate > emails. Please do not CC me; I read this list.] > sure. > > * mhh...@gmail.com > [170509 > 07:40]: > > : ( thanks > > > > $ man gofmt > > Aucune

Re: [go-nuts] why received can be defined with/without pointer?

2017-05-09 Thread mhhcbon
On Tuesday, May 9, 2017 at 2:21:52 PM UTC+2, Volker Dobler wrote: > > On Tuesday, 9 May 2017 12:30:38 UTC+2, mhh...@gmail.com wrote: >> >> in short and put straightly, >> 1- i think its not appropriate to let us >> define pointer/non pointer attribute >> of a type over multiple points in the co

Re: [go-nuts] Re: use of builtin print for debug

2017-05-09 Thread mhhcbon
: ( thanks $ man gofmt Aucune entrée de manuel pour gofmt /no such entry/ *$ gofmt -husage: gofmt [flags] [path ...] -r stringrewrite rule (e.g., 'a[b:len(a)] -> a[b:]')* https://golang.org/cmd/gofmt/#hdr-Examples How to take advantage of it ? He needs to add new func, probably. A

Re: [go-nuts] Re: suggest: improve go gen intergration for non core code ?

2017-05-09 Thread mhhcbon
thanks for feedback, i put that in regards to my understanding of go generate, re run it anytime its needed, anytime you changed your code, please see https://groups.google.com/forum/#!topic/golang-nuts/8L_bjxB-_T0 that concretely demonstrates why i don t go with the "usual thinking". On Tuesda

[go-nuts] Re: suggest: improve go gen intergration for non core code ?

2017-05-09 Thread mhhcbon
Maybe that could be a simple go sub command: go gun [...packages] gen+run=>gun Sure i could do on my end, it won t be adopted so ... useless. On Friday, May 5, 2017 at 3:15:25 PM UTC+2, mhh...@gmail.com wrote: > > Hi, > > just a suggestion to improve go gen adoption rate, maybe. > > go genera

[go-nuts] Re: use of builtin print for debug

2017-05-09 Thread mhhcbon
ast transformation seems a good candidate for your problem. Should not be very difficult. start with https://godoc.org/golang.org/x/tools/go/loader Learn ast struct with https://golang.org/pkg/go/ast/#Print might be helpful https://gist.github.com/mh-cbon/3ed5d9c39e9635cfed0f89698133 Als

[go-nuts] Re: [ANN] listser/mutexer/channeler: generators.

2017-05-09 Thread mhhcbon
Hi, i want to share some more with you as i feel like it looks good to whoever interested into speeding up his programming experience with go ;) Until now i presented works that took a type T and produce a derived type T2 of it. Easy stuff, not so useful unless you only want to do rpc stuffs. B

Re: [go-nuts] why received can be defined with/without pointer?

2017-05-09 Thread mhhcbon
thanks, > The definition of the method always makes it clear whether you are passing a value of the type or a pointer to the type. People defining methods on large types should know which one want to use. in short and put straightly, 1- i think its not appropriate to let us define pointer/n

[go-nuts] Re: adding context.Context to new code

2017-05-09 Thread mhhcbon
I want something similar too. Automatic and smart insertion of context args in a chain of calls. Methods signature updates are easy, but how to appropriately insert context check in the ast ? I m not sure yet. >The difficulty here seems to differentiate intra package calls from calls to stand

Re: [go-nuts] why received can be defined with/without pointer?

2017-05-07 Thread mhhcbon
yes, sorry you scratched your head https://play.golang.org/p/Gg6Euyvsw6 this example shows that it is possible to do all the things. hth. I m curious to know more about other questions. Maybe they are not good idea, or not technically achievable. Just curious. On Sunday, May 7, 2017 at 2:55:58

[go-nuts] Re: download link - 400 error code

2017-05-06 Thread mhhcbon
hi, you are referring to the downloads available here https://golang.org/dl/? Here the linux one works. i can t find mirror of them. Have you searched for yourself ? Maybe we might try to host it over bt if no one come up with a mirror. Do you know a host that works for you? On Saturday, May

[go-nuts] Re: json with comments

2017-05-06 Thread mhhcbon
awesome package :) The syntax looks great! Especially the forgiving one. On Saturday, May 6, 2017 at 2:01:26 PM UTC+2, Michael Gross wrote: > > Hi, > > even tough json is a data exchange format I find it sometimes useful to > use these files as configs. > Then after a while you would like to

[go-nuts] why received can be defined with/without pointer?

2017-05-06 Thread mhhcbon
Hi, Question about the receiver of a func. It can be defined as star/no star, and consumed as star/nostar. The understanding i have so far is, it let the developer define the memory model he d like to use. It leads to cases such as - define start/nostar on a type - consume a stared type as a v

[go-nuts] suggest: improve go gen intergration for non core code ?

2017-05-05 Thread mhhcbon
Hi, just a suggestion to improve go gen adoption rate, maybe. go generate is not included in the go build pipeline, for good reasons, especially for the core code. It s a two step command, 1- go gen 2- go build Although, since vendoring is implemented, I think it would be good to re think its u

Re: [go-nuts] go get + build flag to set version var

2017-05-05 Thread mhhcbon
sorry, mistake, ** My point is not criticize, but the way you describe the *how* that pipeline should happen IRL. That desciption seems taken from controlled environment such as - internal company - oss distro On Friday, May 5, 2017 at 2:57:44 PM UTC+2, mhh...@gmail.com wrote: > > yeah i agree.

Re: [go-nuts] go get + build flag to set version var

2017-05-05 Thread mhhcbon
yeah i agree. But (:/), i think its pipeline issue in the consumption of a go package. In the same way the language is made to prevent user errors (as much as possible, and its difficult) that go get pipeline usage should help in that matter too. My point is not criticize, but the way you descr

Re: [go-nuts] go get + build flag to set version var

2017-05-05 Thread mhhcbon
Just to add on this that the fact i provide pre built bin is not winning against go get, The repo i took as example is providing, https://github.com/mh-cbon/emd/releases and all possible ways to install it i can provide, https://github.com/mh-cbon/emd#install So yeah i did my best, i loosed. O

Re: [go-nuts] go get + build flag to set version var

2017-05-05 Thread mhhcbon
I totally agree with you and implemented such build pipeline. But still, the fact is i have such situation, I might run after each and every ticket like this, that does not seem a run i can win ;) On Friday, May 5, 2017 at 2:21:58 PM UTC+2, Jakob Borg wrote: > > For end users I strongly recommen

[go-nuts] go get + build flag to set version var

2017-05-05 Thread mhhcbon
Hi, For a program i provide a pre build binary built with go install --ldflags "-X main.VERSION=$VERSION" So when users met a problem they can report the version easily and certainty. the version variable is set by default to "0.0.0", could be empty string. What should be the cmd line to gi

[go-nuts] Re: [ANN] listser/mutexer/channeler: generators.

2017-05-04 Thread mhhcbon
hi, happy it helped! On Thursday, May 4, 2017 at 10:13:42 AM UTC+2, Ben Davies wrote: > > Interesting stuff! Thanks for the pointer on > https://github.com/mh-cbon/mutexer >

  1   2   3   >