Re: [go-nuts] Help me study resources or guides

2023-04-28 Thread Matt KØDVB
You can find my video class at 
https://www.youtube.com/playlist?list=PLoILbKo9rG3skRCj37Kn5Zj803hhiuRK6; 
people seem to like it

Matt

> On Apr 26, 2023, at 9:45 PM, Nyilynn Htwe  wrote:
> 
> I am starting to learn GO programming language with this course 
> . Can you all guide 
> me how to learn and how to be geek at Go? 
> Thank you for reading
> 
> -- 
> 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 web visit 
> https://groups.google.com/d/msgid/golang-nuts/e12e-c9c9-4481-b0eb-c33a6632b768n%40googlegroups.com
>  
> .

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/7816FC1C-8447-456D-9F2A-9608299D92F2%40k0dvb.com.


Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread Matt KØDVB
I didn't say Java didn't have late binding, but that it didn't have late
binding of every possible type (the "all things" in Kay's quote).

On Tue, Nov 22, 2022 at 10:25 AM Robert Engels 
wrote:

> Why do you say that Java does not have late binding. It 100% does. In fact
> the JVM supports dynamic dispatch to make this as efficient as possible.
> Then the JIT optimizes it even more based on runtime behavior.
>
> On Nov 22, 2022, at 10:18 AM, Matt KØDVB  wrote:
>
> 
> But see https://en.wikipedia.org/wiki/Self_(programming_language)
>
> Self was considered an OO language back when I was a grad student and is
> still listed that way today, even though it has neither classes nor
> inheritance.
>
> Anyway, my point would be that the term OO originates with Alan Kay and
> the team at Xerox PARC; Kay’s response to the OO flame wars was to
> de-emphasize classes and inheritance.
>
> Of course, using his definition, neither Java nor Go would be “truly” OO
> since not all things use late binding :-)
>
> Perhaps we can talk about class-based and non-class based OO languages?
>
> On Tue, Nov 22, 2022 at 10:07 AM Robert Engels 
> wrote:
>
>> The wiki OO page lists classes as a requirement - but not necessarily
>> inheritance. Class variables require classes.
>>
>> Also, your link does not work.
>>
>> > On Nov 22, 2022, at 9:56 AM, Jan Mercl <0xj...@gmail.com> wrote:
>> >
>> > On Tue, Nov 22, 2022 at 4:43 PM Robert Engels 
>> wrote:
>> >
>> >> Go is not listed as an OO language on Wikipedia.
>> >
>> > Check https://en.wikipedia.org/wiki/Go_(programming_language):
>> > "ParadigmMulti-paradigm: concurrent imperative, object-oriented[1][2]"
>> >
>> >> Personally I think it is OO-like. OO typically has inheritance.
>> >
>> > Typically they may, but that's not the same as what a requirement
>> > would be, right?
>> >
>> >> There are also no “class variables” - only package level - which makes
>> some encapsulation patterns harder (every class has to become a package).
>> >
>> > No class has to become a package because Go has no classes. You may
>> > think of what a "class" in Go means, but you have not defined that
>> > idea and the language specification is somehow silent about Go
>> > classes.
>> >
>> > --
>> > 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 web visit
>> https://groups.google.com/d/msgid/golang-nuts/CAA40n-U%3DG8gqAZEHrnLUxbg5vsAcRkNV35c86c79xcrhSzLSWw%40mail.gmail.com
>> .
>>
>> --
>> 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 web visit
>> https://groups.google.com/d/msgid/golang-nuts/A1F03B77-7CDC-46CC-B2E0-2C3C1B7DC966%40ix.netcom.com
>> .
>>
>
>
> --
>
> Matt
> K0DVB
>
> --
> 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 web visit
> https://groups.google.com/d/msgid/golang-nuts/CANRS-2%2Bre6WUFT6tE8QinUZ-ipqLvwNTr2hoHNiD4H%3DwQ8T7HA%40mail.gmail.com
> <https://groups.google.com/d/msgid/golang-nuts/CANRS-2%2Bre6WUFT6tE8QinUZ-ipqLvwNTr2hoHNiD4H%3DwQ8T7HA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>

-- 

Matt
K0DVB

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/CANRS-2%2Bmh04pZ_azKuknUe0%3DtVJE4JS_ZZV%2BjBijS%2BCBcQOOaQ%40mail.gmail.com.


Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread Matt KØDVB
But see https://en.wikipedia.org/wiki/Self_(programming_language)

Self was considered an OO language back when I was a grad student and is
still listed that way today, even though it has neither classes nor
inheritance.

Anyway, my point would be that the term OO originates with Alan Kay and the
team at Xerox PARC; Kay’s response to the OO flame wars was to de-emphasize
classes and inheritance.

Of course, using his definition, neither Java nor Go would be “truly” OO
since not all things use late binding :-)

Perhaps we can talk about class-based and non-class based OO languages?

On Tue, Nov 22, 2022 at 10:07 AM Robert Engels 
wrote:

> The wiki OO page lists classes as a requirement - but not necessarily
> inheritance. Class variables require classes.
>
> Also, your link does not work.
>
> > On Nov 22, 2022, at 9:56 AM, Jan Mercl <0xj...@gmail.com> wrote:
> >
> > On Tue, Nov 22, 2022 at 4:43 PM Robert Engels 
> wrote:
> >
> >> Go is not listed as an OO language on Wikipedia.
> >
> > Check https://en.wikipedia.org/wiki/Go_(programming_language):
> > "ParadigmMulti-paradigm: concurrent imperative, object-oriented[1][2]"
> >
> >> Personally I think it is OO-like. OO typically has inheritance.
> >
> > Typically they may, but that's not the same as what a requirement
> > would be, right?
> >
> >> There are also no “class variables” - only package level - which makes
> some encapsulation patterns harder (every class has to become a package).
> >
> > No class has to become a package because Go has no classes. You may
> > think of what a "class" in Go means, but you have not defined that
> > idea and the language specification is somehow silent about Go
> > classes.
> >
> > --
> > 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 web visit
> https://groups.google.com/d/msgid/golang-nuts/CAA40n-U%3DG8gqAZEHrnLUxbg5vsAcRkNV35c86c79xcrhSzLSWw%40mail.gmail.com
> .
>
> --
> 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 web visit
> https://groups.google.com/d/msgid/golang-nuts/A1F03B77-7CDC-46CC-B2E0-2C3C1B7DC966%40ix.netcom.com
> .
>


-- 

Matt
K0DVB

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/CANRS-2%2Bre6WUFT6tE8QinUZ-ipqLvwNTr2hoHNiD4H%3DwQ8T7HA%40mail.gmail.com.


Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread Matt KØDVB
The correct answer is actually “yes” because neither classes nor inheritance 
are necessary or sufficient for “object-oriented” programming.

https://www.youtube.com/watch?v=jexEpE7Yv2A

Sent from my iPad

> On Nov 22, 2022, at 9:02 AM, Ayan George  wrote:
> 
> 
> 
> The Go FAQ begins the answer to the question, "Is Go an object-oriented 
> language," with, "yes and no."
> 
>   https://go.dev/doc/faq#Is_Go_an_object-oriented_language
> 
> The section goes on to say that Go has methods but there is no type 
> hierarchy.  I guess those are the yes and no.
> 
> But I feel like programmers bringing their ideas from other less ambiguously 
> object oriented languages like Java and C++ often have difficulty writing 
> idiomatic Go.
> 
> If the answer to that question is "yes and no," it'd be less ambiguous to 
> simply say, "no."  And that would be a definitive way of indicating that it 
> woul be inappropriate to apply many patterns from object oriented languages 
> to Go -- and to encourage people to accept Go for what it is.
> 
> Since receivers are parameters and one could use methods without using the 
> method calling syntax at all, I'd suggest we'd classify it as a structured 
> programming language with methods.
> 
> In either case, is there a way to make the FAQ more clear on this point?
> 
> -ayan
> 
> 
> 
> -- 
> 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 web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAPSh2XBozm9bOe-O3SphET3A3wTif%3D0RiV%3D1Bw6GJkgT3wedLA%40mail.gmail.com.

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/2B1E6084-E6F1-4B21-8ADF-06DA02A56966%40k0dvb.com.


Re: [go-nuts] Right way to fan out work loads

2021-09-08 Thread Matt KØDVB
I’d like to point you to a video I made where I work through different ways to 
divide up work, both the “work pool” approach and just creating lots of 
goroutines:
https://www.youtube.com/watch?v=SPD7TykYy5w=PLoILbKo9rG3skRCj37Kn5Zj803hhiuRK6=27
 

In it I explain how to manage/limit concurrency when the work is I/O bound 
(which is your case).

Matt

> On Sep 7, 2021, at 6:36 PM, David Belle-Isle  wrote:
> 
> 
> Hi,
> 
> I've been facing this question for a while and never managed to find the 
> "right" answer. Hopefully this forum will be able to enlighten me a little 
> bit.
> 
> Given a very simple pattern: Consume some data, transform it, store it (ETL). 
> The storing part is slow(er) and needs to be fanned out.
> 
> The question: What's the best (correct? idiomatic?) way to implement that in 
> Go?
> 
> A) From "main", buffer the incoming data and launch a goroutine and pass it 
> the data to store. Similar to how you could implement a web server handling 
> an incoming connection in Go.
> 
> OR
> 
> B) From "main", create N channels and spin up N goroutines to send down data 
> to workers. Round-robin writes to the N channels.
> B1) Do you buffer the data in "main" or after the channel, in the goroutine?
> 
> I understand that (A) can spin out of control and launch too many goroutines 
> and (B) can run into a bottle neck. Each of these problems can be easily 
> addressed. I'm more interested in hearing what you think is the "right" way 
> to solve this problem?
> 
> Thanks
> 
> David

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/9A8899FB-98A4-4483-B23E-5B5C1CCAEA66%40k0dvb.com.


Re: [go-nuts] string matching

2021-04-01 Thread Matt KØDVB
Use a capture group

regex := regexp.MustCompile(`.*\bCore Count: (\d+)`)
result := regex.FindAllStringSubmatch(raw, -1) 

https://play.golang.org/p/r_TxhVZVfzE 

See also https://www.youtube.com/watch?v=XCE0psygwj8

> On Apr 1, 2021, at 12:32 PM, Artur Vianna  wrote:
> 
> Try the regex: "Core Count: [0-9]+", then split on ":" and select the second 
> part.
> 
> On Thu, 1 Apr 2021, 15:28 Sharan Guhan,  > wrote:
> Hi Experts,
> 
> New to Golang and finding it non trivial to achieve the below efficiently :-) 
> Any pointers will help..
> 
> I have a huge string as below  .. Now from this I want to extract the number 
> "18" after "Core count".. I was thinking of walking through each string with 
> Spilt("\n"), but that will make it slower. I also tried strings.Index with 
> "Core count", but unable to see how to pull the 18 from this..
> 
> Sharan
> 
> 
> "Version: Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz
> Voltage: 1.6 V
> External Clock: 100 MHz
> Max Speed: 4000 MHz
> Current Speed: 2300 MHz
> Status: Populated, Enabled
> Upgrade: Socket LGA3647-1
> L1 Cache Handle: 0x004D
> L2 Cache Handle: 0x004E
> L3 Cache Handle: 0x004F
> Serial Number: Not Specified
> Asset Tag: UNKNOWN
> Part Number: Not Specified
> Core Count: 18"
> 
> -- 
> 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 web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAGOT8aq8btVfAYWCpGz69cvPG_OQomNGyUjBg7oa85%2BAKqp7yQ%40mail.gmail.com
>  
> .
> 
> -- 
> 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 web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAE%3DAWBUkNucnBM762j-3fPu%2BD8wEMbo4xe%2B4QxM40oosiqCq7w%40mail.gmail.com
>  
> .

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/43FB3428-4EAE-4324-A10E-C76EB38C160A%40k0dvb.com.


Re: [go-nuts] Few questions regarding Generics

2021-02-22 Thread Matt KØDVB
Make Map a function not a method (not sure it can be made a method they way 
you’re trying):

package main

import (
"fmt"
"strconv"
)

type List[T any] []T

func ToList[T any](v []T) List[T] {
return List[T](v)
}

func Map[T, U any](l List[T], f func(v T) U) List[U] {
r := make(List[U], len(l))
for i, x := range l {
r[i] = f(x)
}
return r
}

func main() {
x := []int{1, 2, 3}
y := ToList(x)
fmt.Println(y)
fmt.Printf("%q\n", Map(y, strconv.Itoa))
}


https://go2goplay.golang.org/p/F8ZojZF-ZPL 



> On Feb 22, 2021, at 7:03 AM, Khosrow Afroozeh  wrote:
> 
> I was playing with the go2go playground, and while implementing a toy List 
> type, came across a few issues (Sorry if these have been discussed before, my 
> cursory search didn't turn out to find anything). Given the type
> 
> type List[T any] []T
> 
> 1. The current go2go implementation does not allow one to do this:
> 
> func ToList[T any](v []T) List[T] {
> return List(v)
> }
> 
> with the error: List(v) is not a type
> 
> Is this a bug, shortcoming of the current implementation, or by design? This 
> would be a deal breaker if type-casting doesn't work for generics.
> 
> 2. It seems impossible to implement a type-safe Map function. The following 
> code:
> 
> func (l List[T]) Map(f func[U any](v T) U) List[U] {
> return nil
> }
> 
> will not compile, with the error: function type cannot have type parameters
> Judging by the error message this seems to be by design, but it will 
> significantly reduce the usability of generics for any transformation method. 
> What is the reasoning behind this limitation?
> 
> 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 from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/2aa1c2cb-e7bc-438e-81a9-e4a2904af21cn%40googlegroups.com
>  
> .

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/44EBFBBB-71E4-43C4-82E7-3191D5D50DBE%40k0dvb.com.


[go-nuts] [ANN] New Go video course on YouTube

2021-02-21 Thread Matt KØDVB
I've just completed my project to make a recording of my Go class and the 
videos are all now available (ad-free) on YouTube:

https://www.youtube.com/playlist?list=PLoILbKo9rG3skRCj37Kn5Zj803hhiuRK6

This class is suitable for folks who already know how to program in another 
language.It covers the basics and then some, as well as a good bit of the 
toolchain [44 segments totaling about 21 hours]. The class roughly follows *The 
Go Programming Language* and works through a few of the exercises from it. 
In the later parts I also toss in a few thoughts about software development 
& testing.

Slides and a lot of the code available on Github, referenced from the video 
segments. Some code repos have a "run on repl.it" button so you can try 
them out immediately.

I also have a repo of learning resources (references to books, videos, 
blogs, etc.) at https://github.com/matt4biz/go-resources

Constructive feedback welcome (there are already a couple of known bugs and 
one or two senior moments ;-). Enjoy!

-- 
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 web visit 
https://groups.google.com/d/msgid/golang-nuts/e0230440-ebd5-40b9-abf9-035d1cb09fa7n%40googlegroups.com.