--- Log opened Tue Apr 12 00:00:50 2011
00:05 -!- m4dh4tt3r [~Adium@2.sub-75-208-15.myvzw.com] has joined #go-nuts
00:06 -!- vsayer [~vivek@c-98-248-228-200.hsd1.ca.comcast.net] has joined #go-nuts
00:07 -!- foocraft [~dsc@78.100.166.168] has joined #go-nuts
00:08 < exch> mm time.Sleep() seems to be broken here :<
00:08 < exch> time.Sleep(1e9) never finishes sleeping
00:08 < KirkMcDonald> That sleeps for a billion seconds.
00:09 < KirkMcDonald> Er, no.
00:09 < exch> 1 second
00:09 < KirkMcDonald> Apparently I cannot read.
00:09 -!- JusticeFries [~JusticeFr@173-8-247-218-Colorado.hfc.comcastbusiness.net]
has quit [Quit: JusticeFries]
00:09 -!- joelkronander
[~joelkrona@c-bf2fe253.617-1-64736c22.cust.bredbandsbolaget.se] has joined
#go-nuts
00:09 < KirkMcDonald> And somehow mixed up the Seconds() documentation with
the Sleep() documentation.
00:09 < KirkMcDonald> They're, like, right next to each other.
00:09 < exch> http://www.pastie.org/1784958 this just prints 'looping'
indefinitely
00:10 < exch> I put a println() right after the time.Sleep().  its never
reached
00:10 < KirkMcDonald> Perhaps there is a delay in the time it takes it to
print out the necessary number of strings.
00:11 < KirkMcDonald> So the process is blocking on the output.
00:11 < exch> mm it works when I switch to fmt.Println
00:11 < KirkMcDonald> Because I suspect the machine can complete rather a
lot of iterations of an infinite loop in the space of a second.
00:11 < KirkMcDonald> Curious.
00:11 < exch> I think it's a scheduling thing
00:14 < Glasswalker> so if type A has a channel as a field, and spawns a
dozen goroutines that loop infinitely.  It wants to signal these goroutines (using
the channel which is a field) to stop looping and shut down.
00:14 < Glasswalker> What is the "best practice" way to do that?
00:15 < Glasswalker> By closing the channel?  and trying to detect that
within the looping goroutines?
00:15 < exch> Glasswalker: look a my pastie
00:15 < Glasswalker> or by sending a signal?  (like in several of the online
examples)
00:15 < exch> *at
00:15 < Glasswalker> which pastie?
00:15 < exch> it's basically what you are already doing, so it should not
block on the read from Quit
00:15 < dfc> Glasswalker: if the sole job of these goroutines is to poll the
channel
00:15 < exch> http://www.pastie.org/1784958 this one
00:15 < dfc> then closing the channel will suffice
00:16 < dfc> if they have more complicated semantics
00:16 < dfc> then each goroutine should be modeled by a struct
00:16 < dfc> with it's own Close chan bool, 1 channel
00:17 -!- virtualsue [~chatzilla@nat/cisco/x-yckxhdgavbrkjrcx] has quit [Quit:
ChatZilla 0.9.86.1 [Firefox 4.0/20110318052756]]
00:17 < Glasswalker> dfc ok, I'm using a close chan bool
00:17 < Glasswalker> one sec, reading exch's pastie first
00:18 < exch> if you change those 'println's with 'fmt.Println', it works as
expected
00:18 < Glasswalker> right, exch: that's what I'm doing
00:18 < exch> yea, so that should do the trick really
00:18 < Glasswalker> but it blocks on the read from the channel
00:18 < exch> it keeps executing the default case, as long as nothing
happens to c
00:18 < Glasswalker> and never gets to the default
00:19 < exch> something, somewhere else is presumably going wrong then..
00:20 -!- bugQ [~bug@c-71-195-207-98.hsd1.ut.comcast.net] has joined #go-nuts
00:20 < Glasswalker> http://www.pastie.org/1784978
00:21 < Glasswalker> full source
00:21 < Glasswalker> see ClientListenerHandler, and PeerListenerHandler
00:21 < Glasswalker> and Close() sends the signals to the "Quit" channel
00:21 < Glasswalker> quit channel defined in the DAMBSServer struct
00:22 < Glasswalker> that code compiles fine, but when I run it, it echoes
the "Launching" message before spawning the goroutine.  but then never goes any
further.
00:22 -!- Adys [~Adys@unaffiliated/adys] has joined #go-nuts
00:24 < Glasswalker> the whole thing is called when an external package
calls NewServer() which fires up the listeners.  Then that calling package loops
indefinitely (for now, later it will do more)
00:24 -!- JusticeFries [~JusticeFr@236.sub-69-98-190.myvzw.com] has joined
#go-nuts
00:24 < exch> mm
00:25 -!- JusticeFries [~JusticeFr@236.sub-69-98-190.myvzw.com] has quit [Client
Quit]
00:26 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
00:27 < Glasswalker> Now we discussed the breaks, which I need to fix
00:27 < Glasswalker> but it's not even throwing the "Quit signal received"
message
00:28 < Glasswalker> so it's not getting inside that case (because the
signal never gets thrown on the Quit channel)
00:28 -!- Pie`` [~pie@kjal.demon.co.uk] has quit [Ping timeout: 260 seconds]
00:28 < Glasswalker> so it's just hanging at line 99 (in the case of
ClientListenerHandler())
00:28 < Glasswalker> which implies it's blocking on the channel read
00:29 < exch> those channel selects used to be blocking calls.  Are you sure
you have the appropriate Go version?
00:30 < skelterjohn> can i see the pastebin?
00:30 < Glasswalker> http://www.pastie.org/1784978
00:30 < exch> http://www.pastie.org/1785001 this one works as expected
00:30 < exch> prints 'looping' until the quit channel is closed one second
later
00:31 < dfc> Glasswalker: make the Quit channel non blocking
00:31 < exch> it is nonblocking if you include a default case
00:31 < dfc> sv := &DAMBServer{ ...  Quit: make (chan bool, 1) }
00:31 < exch> which he has
00:31 < exch> he doesnt need the buffered chan
00:31 < dfc> blocking to read
00:31 < dfc> not blocking to send
00:32 < exch> there is read block with the default case
00:32 < exch> *no read block
00:32 < exch> at least in the current version of Go
00:32 < Glasswalker> I'm using a recent weekly
00:32 < Glasswalker> trying to confirm which version I have now
00:33 < exch> can you run this and see what it does?
http://www.pastie.org/1785001
00:36 < Glasswalker> loops for a while
00:36 < Glasswalker> then says end
00:36 < Glasswalker> and stops
00:37 < exch> k so it works
00:37 < exch> it uses the same setup yuo have
00:37 < Glasswalker> so the question is...  what did I break in my code?  :)
00:37 < exch> *you
00:37 < exch> good question
00:37 -!- binarypie [~binarypie@adsl-99-35-135-146.dsl.pltn13.sbcglobal.net] has
joined #go-nuts
00:38 -!- binarypie [~binarypie@adsl-99-35-135-146.dsl.pltn13.sbcglobal.net] has
quit [Remote host closed the connection]
00:38 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Read
error: Connection reset by peer]
00:38 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
00:39 < exch> even with two separate goroutines it works
00:39 < exch> so that's not the issue either
00:39 < Glasswalker> adding some output to the calling routine's loop with a
sleep in between
00:39 < Glasswalker> so I can see that it is in fact still running, just
nothing happening on the others.
00:41 < Glasswalker> ok...  what the hell
00:41 < Glasswalker> works fine now
00:41 < Glasswalker> all I did was add a sleep to the loop
00:41 < Glasswalker> think it was a scheduler issue (main loop iterating
forever was drowning the other goroutines out?)
00:41 < skelterjohn> yes, that can happen
00:42 < skelterjohn> set GOMAXPROCS to more than one
00:42 < skelterjohn> as far as i know, though, time.Sleep() won't yield
00:43 -!- vsayer [~vivek@c-98-248-228-200.hsd1.ca.comcast.net] has quit [Ping
timeout: 276 seconds]
00:43 < skelterjohn> you can use runtime.Gosched() to force a yield, if you
want things to definitely be concurrent
00:43 < plexdev> http://is.gd/RUBtyv by [Nigel Tao] in go/src/pkg/net/ --
net: fix laddr typo in test code.
00:50 -!- tylergillies [~quassel@unaffiliated/tylergillies] has quit [Read error:
Connection reset by peer]
00:53 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
00:53 -!- tensorpudding [~user@99.32.63.28] has quit [Read error: Connection reset
by peer]
00:59 -!- tylergillies [~quassel@204-232-205-180.static.cloud-ips.com] has joined
#go-nuts
00:59 -!- tylergillies [~quassel@204-232-205-180.static.cloud-ips.com] has quit
[Changing host]
00:59 -!- tylergillies [~quassel@unaffiliated/tylergillies] has joined #go-nuts
01:00 -!- m4dh4tt3r [~Adium@2.sub-75-208-15.myvzw.com] has quit [Ping timeout: 258
seconds]
01:02 -!- nettok [~quassel@200.119.157.225] has joined #go-nuts
01:06 -!- tylergillies [~quassel@unaffiliated/tylergillies] has quit [Remote host
closed the connection]
01:07 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
01:09 -!- saturnfive [~saturnfiv@210.74.155.131] has joined #go-nuts
01:10 -!- mikespook [~mikespook@219.137.253.123] has joined #go-nuts
01:13 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
01:14 -!- amacleod [~amacleod@pool-173-76-201-233.bstnma.fios.verizon.net] has
joined #go-nuts
01:15 < exch> ooh, Virgin is hiring fulltime astronauts :o Here's a golden
chance to make that one remaing childhood dream a reality!
01:17 < dfc> i'm still working on being a Vet and a Fireman
01:17 < exch> you're lagging behind friend!
01:17 < dfc> i've lived a sheltered life
01:19 -!- boscop [~boscop@g227141251.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
01:20 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
01:21 -!- dropdrive [~dropdrive@cpe-72-227-159-70.nyc.res.rr.com] has quit [Read
error: Operation timed out]
01:23 -!- carrus85 [~carrus85@64.0.193.15] has quit [Quit: Leaving]
01:31 -!- boscop [~boscop@g226247234.adsl.alicedsl.de] has joined #go-nuts
01:34 -!- eikenberry [~jae@68.118.117.234] has quit [Quit: End of line.]
01:35 -!- dropdrive [~dropdrive@cpe-72-227-159-70.nyc.res.rr.com] has joined
#go-nuts
01:37 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Read
error: Operation timed out]
01:40 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
01:46 -!- bugQ [~bug@c-71-195-207-98.hsd1.ut.comcast.net] has quit [Ping timeout:
252 seconds]
01:47 -!- rbraley [~rbraley@114.250.85.173] has quit [Ping timeout: 276 seconds]
01:50 -!- boscop [~boscop@g226247234.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
01:51 -!- skelterjohn_ [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
01:51 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Read
error: Connection reset by peer]
01:52 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Client
Quit]
02:00 -!- rbraley [~rbraley@114.250.85.28] has joined #go-nuts
02:05 -!- mikespook [~mikespook@219.137.253.123] has quit [Read error: Operation
timed out]
02:06 -!- boscop [~boscop@g226244114.adsl.alicedsl.de] has joined #go-nuts
02:06 -!- mikespook [~mikespook@219.137.253.123] has joined #go-nuts
02:09 -!- rurban [~demo@178-191-212-119.adsl.highway.telekom.at] has joined
#go-nuts
02:19 -!- amacleod [~amacleod@pool-173-76-201-233.bstnma.fios.verizon.net] has
quit [Quit: Bye Bye]
02:20 -!- benjack [~benjack@bb220-255-241-76.singnet.com.sg] has joined #go-nuts
02:30 -!- krutcha1 [~krutcha@S010600045a27676a.vs.shawcable.net] has joined
#go-nuts
02:36 < Glasswalker> So having a minor issue...  Getting a runtime error in
my code.  This code: http://www.pastie.org/1785290 is throwing an error at line 4
(it's line 88 in the file) the error output is: http://www.pastie.org/1785292
02:36 < Glasswalker> I know that the buf array is length 65536 and it did
receive bytes (at least 20-30 bytes)
02:37 < Glasswalker> so why is it throwing an index out of range error?
02:37 < dfc> packet.Size = binary.LittleEndian.Uint16(buf[1:2
02:37 < dfc> ^ btw,you don't need ()'s around if clauses
02:37 < dfc> and you don't need ;'s
02:37 < Glasswalker> oh I know, forcive habbit (old C programmer)
02:37 < Glasswalker> lol
02:37 < dfc> gofmt can fix that up for you
02:38 < dfc> the reason you're getting our of range len(buf) < 1
02:38 < Glasswalker> it's not though
02:38 < Glasswalker> see in the output
02:38 < Glasswalker> It's output BYTECOUNT RECEIVED and ouputting len(buf)
02:38 < Glasswalker> in the output it's saying len(buf) = 65536
02:38 < Glasswalker> right before the panic runtime error
02:39 < Glasswalker> that was my first thought is that buf was overrunning
02:39 < dfc> nah, slices/arrays are 32bit safe
02:39 < Glasswalker> (or more it was zero and the reference to it was
running over it)
02:39 < dfc> try
02:39 < Glasswalker> yeah sorry tired, said that wrong
02:39 < Glasswalker> lol
02:39 < dfc> fmt.Printf("%#v", buf)
02:40 < Glasswalker> ok
02:40 < Glasswalker> one sec
02:40 < dfc> will (should) print the contents of the array
02:41 -!- vsayer [~vivek@2001:470:1f04:1a6b:21a:6bff:fe35:d2a5] has joined
#go-nuts
02:42 < Glasswalker> []byte{0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
0x58, 0x58, 0xd, 0xa, 0x0, 0x0, 0x0......  (and on and on for some time)
02:42 < Glasswalker> (I sent XXXXXXXXXX to it via telnet)
02:43 < dfc> acket.CryptoFlag = uint8(buf[0]);
02:43 < dfc> ^ you don't need the cast
02:44 < Glasswalker> ok fixed that.  but that won't be related to the issue
02:44 < dfc> no
02:44 < Glasswalker> or shouldn't at least :)
02:45 < dfc> so, i can't explain why this is blowing up
02:45 < dfc> but before the guys will look at it
02:45 < dfc> you need to log an issue with the smallest possible test case
02:45 < dfc> as they are stupid bust
02:45 < dfc> busy
02:45 < dfc> so
02:45 < dfc> b := []byte { 0, 255, 255 }
02:46 < dfc> u := binary.LittleEndian.Uint16(b[1:2])
02:46 < dfc> if that blows up
02:46 < dfc> then something is wrong with your runtime
02:46 < dfc> if not, possibly you're suffering from linker skew
02:50 < Glasswalker> it blows up
02:51 < Glasswalker> This code: http://www.pastie.org/1785337
02:51 < Glasswalker> Generates: http://www.pastie.org/1785338
02:54 -!- niemeyer_away
[~niemeyer@189-10-155-52.pltce701.dsl.brasiltelecom.net.br] has quit [Ping
timeout: 240 seconds]
02:54 < dfc> i think i know what the problem is
02:54 < dfc> len(b[1:2]) == 1
02:55 < dfc> i think i've misread the slice spec
02:55 < Glasswalker> oh
02:55 < Glasswalker> I understood the spec as from 1 to 2 inclusive
02:56 < dfc> me too
02:56 < Glasswalker> (meaning bytes 1 and 2, so len == 2)
02:56 < dfc> apparently now
02:56 < dfc> not
02:57 < |Craig|> its setup so b[:n]+b[n:] includes everything once
02:57 < dfc> http://golang.org/doc/go_spec.html#Slices
02:57 < dfc> so, you need b[1:3], gives elements 1 and 2
02:58 < Glasswalker> What?  :)
02:58 < Glasswalker> I get it, but damn is that ever screwy
02:58 < dfc> it makes sense if you say
02:58 < dfc> b[:len(b)] == b
02:59 < Glasswalker> sure, but it's still screwy ;)
02:59 < exch> b[:len(b)] can be abbreviated to b[:]
03:00 < exch> or just b
03:00 < exch> :p
03:00 < dfc> exch: yes, but it illistrates the point
03:00 < dfc> so len(b[:10]) == 10
03:00 < dfc> which is why len(b[1:3]) == 2
03:12 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
03:17 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
03:19 -!- tensai_cirno [~cirno@77.232.15.216] has quit [Remote host closed the
connection]
03:21 -!- ahihi2 [~transient@cs181182126.pp.htv.fi] has quit [Read error:
Operation timed out]
03:21 < |Craig|> I think one of the main reasons it works like that is
[n:n-1] to get an empty slice (especially n=0 at the start) would be really
strange
03:25 < KirkMcDonald> Also, it means that a[0:y] and a[y:] will, taken
together, cover the entire array.
03:26 < KirkMcDonald> Oh, which was mentioned.
03:26 < KirkMcDonald> Really it ends up being the most convenient thing.
03:27 < KirkMcDonald> Cuts down on the off-by-one errors.
03:30 -!- nettok [~quassel@200.119.157.225] has quit [Ping timeout: 276 seconds]
03:34 < Rennex> or adds them...
03:50 < dfc> Rennex: i think both options, inclusive and exclusive have
downsides
03:50 < dfc> at least this way yuou can do
03:50 < dfc> b := b[offset:offset+length]
03:50 < Rennex> yep
03:51 < dfc> which is useful for some use cases
03:51 < Rennex> though just as well there could be different syntax for an
inclusive range and for a given length :)
03:52 < dfc> i dunno how well that would fit with Go's small language
philosophy
03:54 < Rennex> indeed..  but it's also a compromise between language size
and error-reducing readability-enhancing features :)
03:55 < dfc> i think there would be arguments for and against two slice
style operators
03:55 < dfc> inclusive vs exclusive
03:56 < dfc> and that alone would probalby be enough for the go authors to
keep the status quo
03:56 < dfc> i'm inclined to agree
03:56 < dfc> the slice syntax is at least consistent
03:57 < dfc> if x, err := io.Something() { } is a far bigger gotcha
04:19 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 246 seconds]
04:23 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 246 seconds]
04:27 -!- keithgcascio [~keithcasc@nat/google/x-sysnsudckfmeoevm] has quit [Quit:
Leaving]
04:28 -!- zozoR [~Morten@5634631b.rev.stofanet.dk] has joined #go-nuts
04:29 -!- fabled [~fabled@83.145.235.194] has quit [Quit: Ex-Chat]
04:30 -!- itrekkie [~itrekkie@ip72-200-105-157.tc.ph.cox.net] has quit [Quit:
itrekkie]
04:32 -!- fabled [~fabled@83.145.235.194] has joined #go-nuts
04:47 -!- ExtraSpice [XtraSpice@88.118.35.153] has joined #go-nuts
04:47 -!- dfr|mac [~dfr|work@ool-182e3fca.dyn.optonline.net] has joined #go-nuts
04:52 -!- Wiz126 [Wiz@h187.120.232.68.ip.windstream.net] has quit [Ping timeout:
246 seconds]
04:56 -!- Wiz126 [Wiz@h187.120.232.68.ip.windstream.net] has joined #go-nuts
04:57 -!- benjack [~benjack@bb220-255-241-76.singnet.com.sg] has quit [Quit:
Leaving.]
05:00 -!- cafesofie [~cafesofie@ool-4a5a6ee5.dyn.optonline.net] has quit [Remote
host closed the connection]
05:08 -!- rurban [~demo@178-191-212-119.adsl.highway.telekom.at] has quit [Ping
timeout: 260 seconds]
05:10 -!- firwen [~firwen@gex01-1-78-234-55-225.fbx.proxad.net] has joined
#go-nuts
05:14 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has joined
#go-nuts
05:25 -!- zozoR [~Morten@5634631b.rev.stofanet.dk] has quit [Remote host closed
the connection]
05:31 -!- krolaw [~krolaw@203.100.208.229] has joined #go-nuts
05:33 -!- crodjer [~rohanjain@203.110.240.205] has joined #go-nuts
05:36 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has quit [Ping
timeout: 260 seconds]
05:48 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has quit [Quit:
Leaving.]
05:50 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
05:52 -!- dfr|mac [~dfr|work@ool-182e3fca.dyn.optonline.net] has quit [Remote host
closed the connection]
05:57 -!- kaichenxyz [~kaichenxy@115.193.159.25] has joined #go-nuts
05:58 -!- kaichenxyz [~kaichenxy@115.193.159.25] has quit [Remote host closed the
connection]
05:58 -!- firwen [~firwen@gex01-1-78-234-55-225.fbx.proxad.net] has quit [Remote
host closed the connection]
05:58 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has joined #go-nuts
05:58 -!- wchicken [~chicken@c-24-7-112-207.hsd1.ca.comcast.net] has joined
#go-nuts
06:04 -!- krutcha1 [~krutcha@S010600045a27676a.vs.shawcable.net] has quit [Quit:
Leaving]
06:04 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Ping
timeout: 246 seconds]
06:10 -!- skejoe [~skejoe@188.114.142.217] has joined #go-nuts
06:10 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
06:19 -!- aho [~nya@fuld-590c6e90.pool.mediaWays.net] has joined #go-nuts
06:23 -!- boscop [~boscop@g226244114.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
06:26 -!- boscop [~boscop@g227133069.adsl.alicedsl.de] has joined #go-nuts
06:26 -!- ios_ [~ios@180.191.128.144] has joined #go-nuts
06:29 -!- ios_ [~ios@180.191.128.144] has left #go-nuts []
06:31 < taruti> Someone should write draw(2) bindings...
06:32 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has quit [Ping
timeout: 252 seconds]
06:33 < kevlar> Thanks for volunteering!
06:33 -!- ako [~nya@fuld-590c7133.pool.mediaWays.net] has joined #go-nuts
06:36 -!- aho [~nya@fuld-590c6e90.pool.mediaWays.net] has quit [Ping timeout: 246
seconds]
06:37 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has joined #go-nuts
06:40 -!- firwen [~firwen@adevlaptop.cern.ch] has joined #go-nuts
06:41 <@adg> Rennex: it's a bad idea to provide multiple ways of specifying
ranges
06:42 <@adg> also, [x,y) is the One True Way :)
06:42 < Rennex> adg: i haven't heard anyone complain about it in ruby :)
06:43 <@adg> that's because their code is so full of runtime errors they
don't notice the off-by-one errors ;)
06:43 <@adg> (i joke)
06:43 < Rennex> [start..end], [start...end_noninclusive], [start, length] if
you didn't know
06:43 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
06:46 <@adg> that just seems insane to me
06:46 < KirkMcDonald> Ugh.
06:47 < nsf> :D
06:47 <@adg> so instead of off-by-one errors, you have "forgot the . errors"
06:47 < KirkMcDonald> How on earth can you keep ..  and ...  straight?
06:47 < KirkMcDonald> By rote, I suppose.
06:47 < nsf> [start..end] [start:end_noninclusive] [start, length]
06:47 < nsf> forgot about ':'?
06:48 <@adg> at least ruby's [s:e] is consistent with go
06:48 <@adg> so there's no confusion there
06:48 < Rennex> well i'm not a big fan of the ...
06:48 <@adg> how about [start......] where the number of dots is the number
of elements
06:48 < Rennex> nsf: there's a different use for : these days
06:48 < Archwyrm> They should use single utf8 characters for elipsis.  :)
06:48 < nsf> like?
06:49 < KirkMcDonald> a[s…e]
06:49 < Archwyrm> :)
06:49 < nsf> yeah, we have unicode, remember?  :)
06:49 < Rennex> nsf: well that would be the same as [{:start =>
end_noninclusive}]
06:49 < nsf> omg
06:49 < nsf> am I on a Go channel?
06:49 < nsf> :)
06:50 < Rennex> you asked :P
06:50 < nsf> it looks like ruby to me
06:50 < nsf> ah
06:50 < nsf> indeed
06:50 < nsf> we were talking about ruby
06:51 < Rennex> yep
06:51 < Namegduf> Wow.
06:51 < Namegduf> So...  Go has one way to slice a thing.
06:51 < nsf> well, if this syntax (I mean different slicing) has to be
applied to Go, I think this is more reasonable:
06:51 < Namegduf> It has...  five?
06:51 < nsf> [start..end] [start:end_noninclusive] [start, length]
06:51 < Rennex> Namegduf: no, 3
06:52 < Namegduf> What about the {} form?
06:52 <@adg> can you override the [x..y] form to mean something else?
06:52 <@adg> like, it could launch a web server that serves handlers from an
array
06:53 <@adg> ;)
06:53 < Rennex> Namegduf: well it was just a map and made no real sense (it
was what [start:end] would mean)
06:53 < Rennex> key:value thing
06:53 < Namegduf> Ah.
06:53 < Rennex> adg: you can!
06:54 < Namegduf> Well, Go already has syntax for specifying the end
inclusively.
06:54 < Namegduf> You add "+1" to it.
06:54 < Namegduf> And length.
06:54 <@adg> Rennex: i thought so.  god
06:54 < Namegduf> You use "start+length" as the end.
06:54 -!- skejoe_ [~skejoe@188.114.142.217] has joined #go-nuts
06:54 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined #go-nuts
06:55 < Namegduf> This is consistent with arithmetic operations elsewhere
and requires no additional special rules for slicing, just the one form.
06:55 <@adg> ruby is like a horror story for programmers, haha
06:55 <@adg> not that i think it's a bad language, it just lets you do such
crazy things
06:55 < Namegduf> Simple.
06:55 <@adg> Namegduf: well said
06:55 -!- mikespook [~mikespook@219.137.253.123] has quit [Ping timeout: 276
seconds]
06:55 < KirkMcDonald> Like reopening the string type to (say) redefine
string comparisons to be case-insensitive.
06:55 -!- mikespook [~mikespook@219.137.253.123] has joined #go-nuts
06:56 < nsf> ruby is not meant for big programs
06:56 < Namegduf> Ruby might be shorter in character count, but while being
shorter helps readability, increased complexity hurts readability
06:56 < nsf> but 95% ruby programmers in the world don't understand that
06:56 < Namegduf> (See Perl for the stereotypical example)
06:56 < KirkMcDonald> On the other hand, I am something of a fan of Python.
06:56 < nsf> matz created ruby for shell-like tasks
06:56 <@adg> one of these days i should learn ruby
06:56 < Namegduf> This is a case where the added complexity doesn't even
approach being worth the decreased character count in special cases.
06:56 < Rennex> Namegduf: ruby's syntax is entirely consistent with
everything else too.  (a..b) and (a...b) are actually Range objects.
06:57 < firwen> Can we speak about Ruby perfs ? ( troll inside :p )
06:57 < Namegduf> Rennex: It would not be in Go, because Go has no such
thing as Range objects.
06:57 -!- skejoe [~skejoe@188.114.142.217] has quit [Ping timeout: 248 seconds]
06:57 < Rennex> if Go had a range type, i'm sure there would be a number of
sensible use cases for it
06:57 -!- piranha [~piranha@D57D1AB3.static.ziggozakelijk.nl] has joined #go-nuts
06:57 < Rennex> now you can't use a:b for any other purpose than array
slicing, can you?
06:58 < Namegduf> a:b isn't a thing.
06:58 < Namegduf> It's two things with a colon between them.
06:58 < Namegduf> Part of slice syntax.
06:58 < Rennex> it's a syntax
06:58 < nsf> Rob Pike sees nightmares like that..  Go with ruby syntax
06:58 < Namegduf> You want to pass around "a range" you can pass around two
numbers.
06:58 < Rennex> you can use + for a bunch of things, what about : ?
06:58 < Archwyrm> nsf: lol!
06:59 * TheMue detects "I wonna feature of lang A in lang B syndrome."
06:59 < Namegduf> Syntax being overloaded is a bad thing, not a good thing.
06:59 < Namegduf> There are no other types in Go with slicing.
06:59 < Namegduf> : is used for slicing.
06:59 < TheMue> Often enough seen this useless discussion, eveerytime when a
new lang raises or an old one gets into focus.
06:59 < Namegduf> It is consistently used with everything sliceable.
06:59 < nsf> btw, why Go has different syntax for type casts and for type
assertions, can it be a single entity?
07:00 < KirkMcDonald> I like how Python handles slicing.
07:00 < Namegduf> Type casts are typesafe in Go
07:00 < KirkMcDonald> Though it is not applicable to Go.
07:00 < Namegduf> Type assertions are not
07:00 < Rennex> TheMue: and i detect "lang B has a feature that
favouritelang doesn't have, therefore it's bloat"
07:00 < nsf> ah, yes, type assertion may fail
07:00 < Namegduf> Yeah.
07:00 < TheMue> Rennex: hehe
07:00 < nsf> but compiler nows that ahead of time anyway
07:00 < KirkMcDonald> In Python, a[x:y] ultimately becomes something like:
a.__getitem__(slice(x, y))
07:00 < Namegduf> Rennex: Your detection methods are wrong.
07:00 < Rennex> TheMue: i'm not even suggesting features from ruby be added
to Go, i'm just saying ruby isn't stupid for having it :)
07:01 < Namegduf> I summarised without reference to Ruby why it was a bad
idea.
07:01 < nsf> x.(int) it will detect that this is a typesafe type cast
07:01 < Namegduf> It adds more complexity than the shortness is worth.
07:01 < Namegduf> Cost higher than benefits.
07:01 < Namegduf> Simple as that.
07:01 < KirkMcDonald> This is inapplicable to Go for two reasons: First, Go
does not have operator overloading.  And second, Go is statically typed.
07:01 < Rennex> Namegduf: you know + is overloaded, right?  assembly has
different instructions for integer addition and floating point addition
07:02 < KirkMcDonald> But anyway, these mean the same thing in Python:
a[x:y] a[slice(x, y)]
07:02 < KirkMcDonald> But actually needing to manipulate slice objects is
quite rare.
07:02 < Rennex> KirkMcDonald: but python is just stupid ;)
07:02 < Namegduf> Rennex: Are you trying to make a point?
07:02 < TheMue> Rennex: I'm now doing software development since 27 yrs.
And every time lang comparison doesn't lead to anything.  So I prefer discussions
on how to solve tasks in a given lang.
07:03 < Rennex> Namegduf: yes, that your summary "syntax overloading is a
bad thing" is wrong
07:03 < Rennex> Namegduf: but moderation in everything, c++ is an example of
doing it wrong :)
07:04 < Namegduf> Ruby is a bigger example.
07:04 < Namegduf> "Let's throw in every feature in the universe, fuck
performance, fuck any concept of safety!"
07:04 < Namegduf> "Let's not even try to consider costs vs benefits for
anything we add!"
07:05 < firwen> overloading in C++ is not a wrong thing, the C++ Users is
the main problem
07:05 < Namegduf> Admittably, a lot of dynamic languages are like this.
07:05 < Namegduf> Overloading is a problem because it results in the meaning
of code not being knowable without knowing everything about everything the code
uses
07:05 < Namegduf> Which is a boost to complexity
07:05 < str1ngs> := can have the same effect though
07:06 < Namegduf> No, it can't.
07:06 < Namegduf> I'm not sure how it could.
07:06 < Namegduf> :='s semantics are defined only by the local scope.
07:06 < nsf> firwen: it is a wrong thing
07:06 < nsf> it's very easy to blame users for everything
07:06 -!- ako [~nya@fuld-590c7133.pool.mediaWays.net] has joined #go-nuts
07:06 < nsf> users are stupid, etc.
07:06 < KirkMcDonald> Or its lack implies that it isn't declared in the
local scope.
07:06 < nsf> but software is being created for users
07:06 < firwen> overloading is less a problem is a static typed langage than
in a dynamic one like ruby
07:06 < nsf> and not users for software
07:07 -!- aho [~nya@fuld-590c7133.pool.mediaWays.net] has quit [Disconnected by
services]
07:07 < Namegduf> firwen: I don't think the static vs dynamic typing is
relevant to the problems of overloading
07:07 < nsf> overloading is bad in static languages, in dynamic languages
there is always overloading by definition
07:07 < str1ngs> nsf: we just need to make software that makes users :P
07:07 -!- boscop [~boscop@g227133069.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
07:07 < nsf> str1ngs: :D
07:07 < Namegduf> Overloading of syntax, that is, using syntax to mean
multiple different things, is bad because it makes things harder to read.  It's
not a major thing but it's not consider "good" for symbols to be reused for
different meanings.
07:08 < Namegduf> Technically, yes, + is overloaded, but it's got a very
limited set of meanings and people can keep them straight reasonably because they
are quite connected.
07:08 < nsf> yeah I agree
07:08 < nsf> I like to mention that it changes semantics of the language
07:08 < nsf> things that had one meaning now means a completely different
thing
07:08 < nsf> and depends on context
07:08 < Rennex> Namegduf: it's not about having every feature, it's about
making syntax handy and at the same time logical, while not caring about the
performance so much
07:09 < nsf> thing*
07:09 < Rennex> ruby that is
07:09 < str1ngs> but that's why I stopped using ruby.  slooow
07:09 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
07:09 < KirkMcDonald> I sort of like how D introduced ~ as an array
concatenation operator, so as to not overload + with that meaning.
07:09 -!- boscop [~boscop@g227133069.adsl.alicedsl.de] has joined #go-nuts
07:09 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined #go-nuts
07:10 < Namegduf> "handy" and "logical" are too vague to evaluate whether
things provide them, or whether they provide actually good goals.
07:10 < KirkMcDonald> On the theory that + could then be used for array
operations like a + 2 adding 2 to each element of the array.
07:10 < Namegduf> Like being efficient to program with for various kinds of
application, good for maintainability, etc
07:10 < firwen> nsf: the main philosophy of C++ is to give a maximum ofpower
to the user, If you want to do dirty thing, you can, but in some situation, it can
be usefull...
07:10 < KirkMcDonald> But D has sort of taken a kitchen sink approach.
07:10 < Namegduf> The main philosophy of C++ doesn't exist
07:11 < Namegduf> It's designed by committee
07:11 < nsf> firwen: I know all about C++, you don't have to tell me that :)
07:11 < firwen> Go has just a different approach
07:11 < firwen> I don't know you sorry :)
07:11 < Namegduf> The problem with C++ isn't that it lets people do "dirty"
things
07:12 < Namegduf> It's that the language is so hugely complex no one person
could possibly know it all.
07:12 < nsf> don't force me to join this talk
07:12 < Namegduf> And when maintaining *other people's code*, you need to
understand all the stuff you can/will come across, not just your personal subset
07:12 < nsf> I have a lot of stuff to say about C++ :D
07:12 < nsf> always
07:13 < KirkMcDonald> One of my greatest pleasures in life is not writing
C++ for a living.
07:13 < nsf> about ruby: I think ruby works for japanese better, because of
the different mentality, asian languages usually use more symbols that other
languages, therefore keeping all the syntax in mind is easier for them (that's my
guess)
07:14 < nsf> as matz says, he created a language that's awesome for himself
in the first place
07:14 < nsf> and then for others
07:14 < Rennex> Namegduf: i think big things that provides maintainability
include readability (which also means brevity is good, up to a point) and not
repeating yourself
07:15 < Namegduf> Simplicity is a big part of readability, as well as
brevity.
07:15 < Namegduf> Readability derives a lot from the amount of brainpower it
takes to understand a line.
07:16 < vsmatck> This is like listening to people argue about which music is
better.
07:16 < nsf> my summary regarding C++: it's tasteless language, like D
07:16 < nsf> vsmatck: :D
07:16 < Rennex> nsf: there really isn't so much in ruby's syntax, i only
know the latin alphabet (and some greek for math) and i have no problems :)
07:16 < Namegduf> Not repeating yourself is good in general but can be
worshipped too much
07:17 < Namegduf> It's a very good idea but it became liked by the kind of
people who take a single idea and make take it to the extreme as far as possible.
07:17 -!- zimsim [~simon@87.72.77.195] has joined #go-nuts
07:17 < nsf> Rennex: well, I don't use ruby much (for shell-like tasks
occasionally) and I have problems relearning syntax every time
07:18 < Namegduf> In general adding a large amount of complexity to avoid
repeating yourself is worse for maintainability than just repeating yourself once
or twice
07:18 < nsf> I can't say the same for python for example
07:18 < Namegduf> But avoiding duplication is good in general, yeah.
07:18 < nsf> yeah, that's the tricky part
07:18 < nsf> there is no simple answer
07:18 < Namegduf> It's all costs vs benefits.
07:18 < nsf> like DRY
07:19 < Rennex> Namegduf: i think simplicity is another thing that some
people take too far.  Ook.  Ook?  Ook!
07:19 < nsf> or copy&paste everything
07:19 < nsf> sometimes it makes sense to C&P
07:19 < nsf> sometimes DRY is a very good approach
07:19 < Namegduf> Rennex: Well, you have basically Go and nothing else
aiming for its kind of simplicity.
07:19 < Namegduf> There's Scheme-style simplicity, but it's not really the
same thing.
07:19 < Namegduf> Go is about being simple to use as well as in
specification, which is different to just having a simple spec.
07:20 < Namegduf> To use/read/etc.
07:20 < nsf> and it's realatively easy to parse
07:20 < nsf> relatively*
07:20 < Namegduf> But, yes, you can take it too far, like most things.
07:20 < Namegduf> I just think most things completely disregard it as a
goal.
07:20 < Namegduf> Which kinda rules that out.
07:21 < Namegduf> The generics proposal is an example of attempts to try to
find a balance.
07:21 < Namegduf> Something with a cost to complexity, but not so much a
cost that it exceeds the benefits.
07:21 < Namegduf> Not got one they like yet, I think.
07:21 < Namegduf> Do each good thing as far as the benefits exceed the
costs, heh.
07:22 < Rennex> imo generics are so useful that leaving them out leads to
cursing
07:23 < Namegduf> Direct equivalents exist
07:23 < Namegduf> You just need to violate DRY for the most direct one
07:24 * Namegduf has his build system duplicate the basic template, same as the
main distribution Vector package works.
07:24 < uriel> oh, more people that have not used Go for anything
significant complaining about how they can't live without generics
07:24 < uriel> *rolls eyes*
07:24 < Rennex> anything can be done by hand...  but cursing leads to anger,
anger leads to hate...
07:24 < Namegduf> Hate leads to destroying everything you loved by making
crappy prequels.
07:26 < Namegduf> A fairly small amount of your code should be sufficiently
abstract in function that you need to have multiple types of it in play, anyway.
07:26 < Namegduf> Thus why in Real Code generics are not a big deal.
07:27 < nsf> Namegduf: I have other opinions as well
07:27 < KirkMcDonald> I have done awful, terrible things with templates.
07:27 < nsf> iant said that generics were useful for writing gold
07:28 < nsf> friend of mine (author of pugixml:
http://code.google.com/p/pugixml/ )
07:28 < nsf> said the same thing
07:28 < nsf> and I'm sure there are more people with that opinion
07:29 < Rennex> writing gold?  i don't get it
07:29 < taruti> type safe containers are one area that would benefit from
generics.
07:29 < nsf> Rennex: gold is a gnu ld compatible linker
07:30 < nsf> that is faster in some cases
07:30 < Rennex> ah :P
07:30 < Namegduf> Type safe containers right now require build system
instantiation
07:30 < nsf> or in most
07:30 < Namegduf> Or just manual instantiation
07:30 < Namegduf> Generics are useful, yeah.
07:30 <@adg> nsf: MUCH faster
07:30 < TheMue> []string is a typesafe container map[string]*Foo too
07:30 < nsf> ok, 5x faster
07:30 < Namegduf> Just not DEAR GOD MUST HAVE OR I CAN'T WRITE A PROGRAM
WHICH DOES ANYTHING.
07:30 < nsf> :)
07:32 < nsf> http://pastie.org/1785916
07:32 < nsf> C++0x is supposed to have better template mechanisms
07:32 < nsf> I've tried it
07:33 < nsf> I felt like it will kill my brain if I keep doing that
07:33 < nsf> :D
07:34 < nsf> if you can understand what this code does exactly and how
07:34 < nsf> you're cool
07:34 < nsf> :D
07:34 < nsf> I can't
07:34 < nsf> even though I wrote it
07:34 < Rennex> i hope c++0x is backwards-compatible with c++
07:34 < KirkMcDonald> I rathed liked D's templates.
07:34 < Rennex> that would be such an epic failure ;)
07:35 < KirkMcDonald> rather*
07:35 < TheMue> nsf: Uuuh, not my lang, definitely not.
07:36 < KirkMcDonald> Huh, to C++ actually did get variadic templates.
07:36 < KirkMcDonald> s/to/so/
07:37 < nsf> KirkMcDonald: with exception that you can't do anything useful
with them
07:37 < nsf> like slicing
07:37 <@adg> Rennex: breaking backward compatibility is the only way c++0x
could be any good imo
07:37 < KirkMcDonald> Fun fun fun.
07:37 < nsf> I've seen in D it's pretty easy
07:37 < KirkMcDonald> Yeah, tuples in D are alright.
07:37 < nsf> the code above does slicing
07:37 < nsf> if you can understand it of course
07:37 < nsf> :D
07:37 < KirkMcDonald> I assume it does the usual car/cons stuff.
07:38 < nsf> I don't remember
07:38 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
07:38 < nsf> but some weird stuff for sure
07:38 < KirkMcDonald> Before D had tuples, you had to do the same trickery.
07:39 < nsf> hehe
07:40 -!- dave [~dfc@eth59-167-133-99.static.internode.on.net] has joined #go-nuts
07:40 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
07:40 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined #go-nuts
07:41 < KirkMcDonald> Here's an ancient bit of D template magic I wrote:
http://dsource.org/projects/pyd/browser/trunk/infrastructure/pyd/func_wrap.d#L95
07:41 < KirkMcDonald> That calls a D function using a Python tuple as the
arguments.
07:42 < nsf> still looks better than C++0x
07:43 < KirkMcDonald> I agree.
07:43 < KirkMcDonald> Can you guess what line 117 does?  :-)
07:43 < nsf> uhm, I don't think so, I don't know D
07:44 -!- dfc [~dfc@eth59-167-133-99.static.internode.on.net] has quit [Ping
timeout: 246 seconds]
07:44 < KirkMcDonald> I'll give you a hint, it is a variable declaration of
sorts.
07:44 -!- petrux [~petrux@host16-224-static.53-82-b.business.telecomitalia.it] has
joined #go-nuts
07:44 < KirkMcDonald> T is a thing called a type tuple.  It represents the
types of the arguments to the function in question.
07:44 -!- Guest98839 [~dfc@eth59-167-133-99.static.internode.on.net] has quit
[Ping timeout: 252 seconds]
07:45 < nsf> yeah, whatever, my head is busy with other thing
07:45 < KirkMcDonald> Okay.  :-)
07:45 < nsf> I'm trying to apply Go's type assertion syntax
07:45 < nsf> as usual type cast syntax
07:45 < nsf> and lexer fails on that:
07:45 < nsf> 5.(int)
07:45 < KirkMcDonald> Because 5.  is a float.
07:45 < nsf> because 5.  is a valid floating point number literal
07:45 < nsf> yeah
07:45 < nsf> it makes it a function call
07:45 < nsf> which doesn't make sense
07:45 < KirkMcDonald> It is calling the float.
07:46 < nsf> I guess I'll have to hack the lexer for that
07:46 < nsf> because float as a callee doesn't make sense anyway
07:46 < nsf> but I don't like hacks :(
07:46 < KirkMcDonald> I don't think you can get out of that without
ugliness.
07:47 < KirkMcDonald> Just require (5).(int) ?
07:47 < KirkMcDonald> Or 5 .(int)
07:47 < nsf> no
07:47 < nsf> well, it is reasonable, because code like that is rare
07:47 < nsf> on the other hand
07:47 < nsf> I need that for testing
07:48 < KirkMcDonald> I mean, on the one hand you have . as a binary
operator, and on the other, you have tokens that can end with .
07:48 < KirkMcDonald> Something has to give.
07:48 < nsf> I can change the syntax
07:48 < nsf> .( as a single token
07:48 < KirkMcDonald> Hmmm.
07:48 < nsf> and then hack the lexer
07:49 < KirkMcDonald> Then you special case it to not match 5.  when .(
could be matched following it?
07:49 < KirkMcDonald> D has almost precisely this hack hiding in it, you
know.
07:49 < KirkMcDonald> D's slice syntax looks like: a[x..y]
07:49 < nsf> uhm, I think I need a special case in a lexer
07:50 < KirkMcDonald> The lexer is special cased to prefer ..  over matching
the float
07:50 < nsf> 5.  as a number literal
07:50 < nsf> and 5.( as a separate token in lexer
07:50 < nsf> which will emit two tokens to parser
07:50 < KirkMcDonald> Hmm.
07:50 < nsf> lexer will match the longest one anyway
07:50 < KirkMcDonald> I see.
07:50 < KirkMcDonald> That's still something of a hack.  :-)
07:51 < nsf> but that way I can even left the grammar as it is
07:51 < nsf> 5.( will emit three tokens in that case :)
07:51 < nsf> 5 . and (
07:51 < nsf> :)
07:51 < nsf> should work just fine
07:52 < nsf> http://pastie.org/1785952
07:53 < nsf> with syntax highlighting it looks better though
07:53 < KirkMcDonald> So this implies the syntax x.(T) has a different
meaning depending on whether T is an interface type.
07:53 < KirkMcDonald> So use a pastebin with syntax highlighting.
07:53 < nsf> I don't have interfaces at the moment, but yeah, why not?  :)
07:53 < KirkMcDonald> Though I guess the existing Go highlighters will have
precisely the problem we just discussed.
07:54 < nsf> no, not really
07:54 < nsf> http://pastie.org/1785958
07:54 < nsf> it's a semantic problem
07:54 < nsf> not a syntax problem
07:54 < nsf> syntax highlighters don't care about semantics
07:55 < nsf> well, most of them don't even recognize syntax
07:55 < nsf> as syntax
07:55 < nsf> they usually do lexing
07:55 < KirkMcDonald> Well, the Go highlighter that I wrote has the problem.
:-) http://paste.pound-python.org/show/5144/
07:56 < nsf> I see
07:56 < nsf> still it highlights something
07:56 < KirkMcDonald> Indeed.
07:56 < KirkMcDonald> But it matches 5.  as a float, then ( as the next
token, and so on.
07:56 < nsf> yeah
07:56 < nsf> as it should
07:56 < nsf> it's invalid Go
07:57 < nsf> I had problems with type cast operator
07:57 < nsf> I didn't want to follow the Go's path
07:57 < nsf> alternatives were: <type>uexpr, [type]uexpr
07:58 < nsf> both are ugly
07:58 < KirkMcDonald> type!expr
07:58 < nsf> KirkMcDonald: it has other problems
07:58 < nsf> I tried that as well :)
07:58 < KirkMcDonald> D uses it for template instantiation.
07:58 < nsf> yeah, I'm aware of that
07:58 < nsf> but in it's: ident!type
07:59 < KirkMcDonald> C!T is approximately equivalent to C<T>...
okay.
07:59 < nsf> postfix form
07:59 < nsf> and ident!(type)
07:59 < nsf> for disambiguation
07:59 < KirkMcDonald> Or when the template has multiple parameters.
07:59 < nsf> yeah
07:59 < nsf> anyways, about <> and []
07:59 < nsf> a < <uint>b // ugly
07:59 < KirkMcDonald> <> has the usual litany of problems.
07:59 < KirkMcDonald> Yes, that.
08:00 < nsf> [uint]myint // kind of blends with everything
08:00 < nsf> [] looks a lot like l and I
08:00 < nsf> so after hours of discussion on a secret ;) irc channel
08:00 < nsf> pexpr.(type)
08:00 < nsf> was choosen )
08:00 -!- wrtp [~rog@92.17.67.64] has joined #go-nuts
08:01 < KirkMcDonald> Clearly the solution is
reinterpret_cast<uint>(b)
08:01 < nsf> chosen*
08:01 < nsf> hehe
08:01 < nsf> D's casts are: cast(uint)b
08:01 < KirkMcDonald> Yes.
08:01 -!- Project_2501 [~Marvin@82.84.93.109] has joined #go-nuts
08:01 < nsf> anyways, it turns out that pexpr.(type) form is quite nice
08:02 < nsf> dndStart.X = int(e.MouseButton().X)
08:02 < nsf> that's real code from gomandel demo
08:02 < nsf> dndStart.X = e.MouseButton().X.(int)
08:02 < nsf> looks better :)
08:02 < nsf> and easier to edit
08:02 < nsf> some cases look ugly though, but whatever
08:03 < nsf> (&data[0]).(unsafe.Pointer)
08:03 < nsf> still reasonable though
08:03 < KirkMcDonald> I still say Go should have gone with * and & as
postfix operators.
08:03 < nsf> unfortunatelly it gives a lot of problems I guess
08:03 < KirkMcDonald> Perhaps.
08:04 < nsf> like conflicts with binary operators
08:04 < nsf> data & & x
08:04 < nsf> data && x
08:04 < nsf> data& & x
08:04 < nsf> nah
08:04 < nsf> bad idea :)
08:04 < KirkMcDonald> And this isn't ambiguous when it is a prefix operator?
08:04 < TheSeeker> data && &x ?
08:04 < nsf> no
08:04 < nsf> prefix isn't ambigous
08:05 < nsf> only for lexer a little bit
08:05 < nsf> data &&x
08:05 < nsf> but it's invalid anyway
08:05 < nsf> data & &x doesn't make sense
08:05 < nsf> data **x works fine
08:05 < KirkMcDonald> nsf: I'm not sure I see the difference between the
prefix and suffix cases, here.
08:06 < nsf> LALR(1) parser sees the difference :)
08:06 < KirkMcDonald> Ah.
08:06 < KirkMcDonald> Of course.
08:06 < KirkMcDonald> You don't know where to go until you get there.
08:06 < nsf> yeah
08:07 < nsf> that's one of my ideas for crawl as well
08:07 < nsf> I wanted clean LALR(1) grammar
08:07 < nsf> unlike Go
08:07 < nsf> Go has few hacks here and there
08:07 < KirkMcDonald> I believe D aimed to be LL(1).
08:07 < nsf> interesting
08:07 < KirkMcDonald> I don't think it succeeded.
08:08 < nsf> hehe
08:08 < nsf> having a clean grammar like that makes parsing speed
predictable
08:08 -!- virtualsue [~chatzilla@nat/cisco/x-mamaqhwbmsxebvxx] has joined #go-nuts
08:08 < KirkMcDonald> Though D is relatively easy to parse.
08:08 < nsf> well Go too
08:08 < nsf> but it has hacks, it can be parsed with yacc still though
08:08 < KirkMcDonald> Certainly any language that isn't C++ is going to try
to avoid C++'s pitfalls.
08:09 < KirkMcDonald> The parser in the D compiler is a hand-written
recursive descent parser.
08:09 < nsf> yeah, I saw the code
08:10 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
08:10 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
08:10 < nsf> ok, I'm back to my lexer
08:10 < nsf> need to finish the hack
08:11 < KirkMcDonald> I seem to recall there being a joke about D being
LL(2), but I can't find it now.
08:12 < nsf> hehe
08:15 < firwen> someone has a link to a bench of gccgo compared to 6g/8g ?
08:16 < firwen> juste to have a short idea of the thing
08:18 -!- Fish-- [~Fish@coss6.exosec.net] has joined #go-nuts
08:21 -!- Fish- [~Fish@exo3753.pck.nerim.net] has quit [Ping timeout: 276 seconds]
08:23 < nsf> nice, lexer hack works
08:23 < nsf> two lines of code for ragel
08:24 < nsf> int_type_cast = digit+ '.' '(';
08:24 < nsf> int_type_cast { tok_int(ts, te-2); tok_op(TOK_DOT);
tok_op(TOK_LPAREN); fbreak; };
08:24 < nsf> of course it's not entirely correct
08:24 < nsf> it doesn't skip whitespaces
08:24 < nsf> will fix that later :)
08:30 -!- randfur [~androirc@58.145.148.26] has joined #go-nuts
08:38 -!- wrtp [~rog@92.17.67.64] has quit [Quit: wrtp]
08:40 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
08:40 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
08:41 -!- comex [comex@c-67-188-10-190.hsd1.ca.comcast.net] has quit [Ping
timeout: 248 seconds]
08:42 -!- comex [comex@c-67-188-10-190.hsd1.ca.comcast.net] has joined #go-nuts
08:47 -!- krolaw [~krolaw@203.100.208.229] has quit [Quit: krolaw]
08:48 -!- randfur [~androirc@58.145.148.26] has quit [Quit: AndroIRC]
08:55 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
08:57 -!- krolaw [~krolaw@203.100.208.229] has joined #go-nuts
09:11 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
09:11 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
09:12 -!- kaichenxyz_ [~kaichenxy@115.193.159.25] has joined #go-nuts
09:15 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has quit [Ping
timeout: 246 seconds]
09:20 -!- kaichenxyz [~kaichenxy@115.193.159.25] has quit [Remote host closed the
connection]
09:20 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has joined #go-nuts
09:23 < Namegduf> You know, it should be possible to verify that/which
panics in a package can possibly escape.
09:23 < Namegduf> It just requires analysing the package, not external code.
09:24 < Namegduf> It'd let you check for any panics not indicating a
programmer error that could leak.
09:24 < Namegduf> (Which would be an error, but in the package, and
detectable)
09:26 -!- joelkronander
[~joelkrona@c-bf2fe253.617-1-64736c22.cust.bredbandsbolaget.se] has quit [Quit:
joelkronander]
09:34 -!- mikespook [~mikespook@219.137.253.123] has quit [Quit: Leaving.]
09:36 -!- saschpe [~quassel@opensuse/member/saschpe] has joined #go-nuts
09:38 -!- tvw [~tv@212.79.9.150] has joined #go-nuts
09:38 -!- dfc [~dfc@124-169-2-171.dyn.iinet.net.au] has joined #go-nuts
09:38 -!- shvntr [~shvntr@113.84.146.107] has joined #go-nuts
09:40 < TheMue> Namegduf: Panics aren't invented as a control mechanism,
they are just panics and can also happen deeply nested.
09:41 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
09:41 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
09:41 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has quit [Quit:
kaichenxyz]
09:45 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
09:46 -!- wrtp [~rog@92.17.67.64] has joined #go-nuts
09:46 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has quit [Remote
host closed the connection]
09:47 -!- elbing [~elbing@32.Red-2-136-86.dynamicIP.rima-tde.net] has joined
#go-nuts
09:49 -!- crodjer [~rohanjain@203.110.240.205] has quit [Ping timeout: 276
seconds]
09:54 -!- skejoe_ [~skejoe@188.114.142.217] has quit [Quit: Lost terminal]
09:55 -!- elbing [~elbing@32.Red-2-136-86.dynamicIP.rima-tde.net] has left
#go-nuts []
10:00 -!- pdamoc [~peter@medical-service.bacau.rdsnet.ro] has joined #go-nuts
10:01 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 246 seconds]
10:01 < pdamoc> hello, one quick question.  I've compiled and linked the
Hello World from the tutorial on Windows XP and I've noticed that the .exe that
resulted is around 1.643 MB...  why is that?
10:02 < pdamoc> in a youtube tutorial I've seen it being around 88k
10:02 -!- sergeykish [~sergeykis@217.12.213.109] has left #go-nuts []
10:03 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
10:04 < pdamoc> I've used 8g and 8l to create the HelloWorld.exe (I don't
know if this is relevant or not but just to be explicit)
10:05 < krolaw> I think you'll find that the 8l result might be 88k.  But as
finished programs are statically linked, 1.6MB isn't that surprising for
HelloWorld.  It certainly is that size on MacOS X.
10:07 < krolaw>
http://golang.org/doc/go_faq.html#Why_is_my_trivial_program_such_a_large_binary
10:09 < krolaw> Hope that helps.
10:10 < pdamoc> oh...  so, if I'm reading this right, the compiled binary is
completely independent from Windows.
10:11 < pdamoc> krolaw: it does help, thanks for your kindness (it's in the
FAQ after all, I should have read that first)
10:11 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
10:11 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
10:11 * krolaw I don't believe so.  There's still some os (just for windows)
hooks, but all the go formatting code fmt is included.
10:12 * krolaw Plus the go runtime.
10:12 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Quit:
peace in teh middle east]
10:12 -!- kaichenxyz [~kaichenxy@115.199.111.22] has joined #go-nuts
10:13 < krolaw> This means that, it starts off large, but unless you import
other stuff, your exe will grow only a little in size as your program code
lengthens.
10:14 < nsf> it's just static linking
10:14 < nsf> as simple as that
10:14 < nsf> gccgo can do dynamic linking
10:14 < nsf> libgo.so is around 5 megs
10:17 < krolaw> AKA, your code occupies a small portion of the exe.  The
rest is the necessary go libs to make the program run complete.
10:18 < pdamoc> so, the exe from the video tutorial was dynamically linked?
10:18 < pdamoc>
http://www.youtube.com/watch?v=X1VHXwhlDmo&feature=player_detailpage#t=488s
10:18 < pdamoc> just to be explicit
10:18 < nsf> if it's a hello world
10:19 < nsf> it could use println
10:19 < nsf> instead of fmt.Println
10:19 < nsf> package main; func main() { println("Hello world"); }
10:19 < nsf> that one should be pretty small
10:19 < pdamoc> yes it does
10:20 < nsf> 190kb on linux
10:20 < nsf> x86
10:20 < pdamoc> I get it now, my version uses fmt and all the fmt is pulled
into the exe....
10:20 < nsf> yeah
10:20 < nsf> it contains all the unicode tables, etc.
10:22 < pdamoc> with println it's 232k :)
10:22 -!- saturnfive [~saturnfiv@210.74.155.131] has quit [Read error: Connection
reset by peer]
10:24 < pdamoc> well...  mystery solved, thank you all again.  bye
10:25 -!- pdamoc [~peter@medical-service.bacau.rdsnet.ro] has quit [Quit: pdamoc]
10:27 -!- hopso [~hopso@a91-152-176-165.elisa-laajakaista.fi] has joined #go-nuts
10:28 -!- shvntr [~shvntr@113.84.146.107] has quit [Quit: leaving]
10:28 -!- joelkronander [~joelkrona@130.236.243.164] has joined #go-nuts
10:31 -!- boscop [~boscop@g227133069.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
10:32 -!- tobier [~tobier@c-1e9de055.712-1-64736c11.cust.bredbandsbolaget.se] has
joined #go-nuts
10:35 < nsf> adg: I have an improvement idea for golang.org, how about
having somewhere on the page two lines, like: "latest release: <date>" and
"latest weekly: <date>"
10:35 < nsf> I was using this one http://golang.org/doc/devel/release.html
10:35 < nsf> but it misses weekly releases :(
10:36 < TheMue> nsf: Yep, full ack
10:36 < nsf> of course I can look at mercurial log
10:37 < nsf> but having that thing on the web page would be nice
10:40 -!- kaichenxyz [~kaichenxy@115.199.111.22] has quit [Remote host closed the
connection]
10:40 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has joined #go-nuts
10:41 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
10:41 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
10:42 -!- hopso [~hopso@a91-152-176-165.elisa-laajakaista.fi] has quit [Quit:
hopso]
10:43 -!- hopso [~hopso@a91-152-176-165.elisa-laajakaista.fi] has joined #go-nuts
10:45 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
10:48 -!- katakuna [pie@kjal.demon.co.uk] has joined #go-nuts
10:58 -!- xash [~xash@d075035.adsl.hansenet.de] has joined #go-nuts
11:07 -!- jesusaurus1 [jesusaur@firefly.cat.pdx.edu] has joined #go-nuts
11:12 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
11:12 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
11:20 -!- xash [~xash@d075035.adsl.hansenet.de] has quit [Quit: Lost terminal]
11:21 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has joined #go-nuts
11:21 < GeertJohan> Hello #go-nuts :)
11:23 < xyproto> GeertJohan: hello
11:23 < GeertJohan> is this channel somewhat active and interesting to
follow ?
11:23 -!- xyproto [~alexander@77.40.159.131] has quit [Quit: WeeChat 0.3.4]
11:24 < hopso> GeertJohan: Not sure about active as I don't have anything to
compare with but it's interesting to follow.
11:24 < firwen> it depends if you want to see god on it or not
11:24 < GeertJohan> I want to see go on it ;)
11:25 < GeertJohan> hehe :P but I'll just idle in here :)
11:25 < firwen> it would be interesting also :p
11:25 < GeertJohan> recently started learning Go
11:25 < GeertJohan> it's really awesome :D
11:26 < GeertJohan> did Java, AVR-C and Arduino before..
11:31 -!- Evesong [~evesong@ruby.nanocore.co.uk] has joined #go-nuts
11:31 < hopso> I do all my programming in Go nowadays.
11:32 < hopso> That¨s going to change when we start using Java in school.
11:32 < hopso> Never liked to it because of all the "public static void"s
11:35 < Evesong> If anyone here is using Go in a production environment,
what's the correct way of "installing" its necessary libs and binaries and
packages somewhere after a clean build, without the $GOROOT source tree?
11:37 < TheMue> Evesong: Currently imho only by hand.  Install virtual
machines according to the targets, build the whole system on your own, zip the
resulting binary and distribute it.
11:38 <@adg> Evesong: you don't need anything but the binaries to run
11:38 < TheMue> As long as 6g and co are used it's all statically linked.
So no need for distribution of libs.
11:38 <@adg> Evesong: all go programs are statically linked
11:38 -!- wrtp [~rog@92.17.67.64] has quit [Quit: wrtp]
11:38 -!- artefon [~thiago@dhcp10.usuarios.dcc.ufmg.br] has joined #go-nuts
11:39 <@adg> Evesong: but if you're talking about deploying the compiler
tools for others to use, it's all relevant
11:39 <@adg> (but you can delete $GOROOT/.hg I suppose)
11:39 < Evesong> Thanks, TheMue + adg
11:41 < TheMue> adg: Btw, regarding my Tideland Common Go Library in the
dashboard, there's one dup (Tideland CGL w/ wrong link) and I would like to change
the description.  Afaik you do those changes?
11:42 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
11:42 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
11:42 -!- krolaw [~krolaw@203.100.208.229] has quit [Quit: krolaw]
11:43 < zimsim> I'm trying to figure out how channels and the select
statement works.  In my test I cant figure out why this program is blocking.
http://pastie.org/1786506
11:45 < TheMue> adg: Hmm, had a disconnect, has the last question about my
CGL been sent?
11:46 < zimsim> TheMue, yes there was something about changing description
for your lib.
11:46 < Evesong> Yes, TheMue ....  <TheMue> adg: Btw, regarding my
....
11:46 < TheMue> Ah, ok, thx
11:49 -!- wrtp [~rog@92.17.67.64] has joined #go-nuts
11:58 -!- saturnfive [~saturnfiv@219.145.57.177] has joined #go-nuts
11:58 -!- saturnfive [~saturnfiv@219.145.57.177] has left #go-nuts []
12:01 < Evesong> The Go spec says that the package ImportPath "may be
relative to a repository of installed packages." When the "repository" is just a
directory, does that directory always have to be relative to $GOROOT (ie.
$GOROOT/src/pkg), or can we define the packages to live elsewhere?
12:02 < exch> you can have them be anywhere you want
12:02 < exch> import "../../foo"
12:02 < exch> where foo is nowhere near the $GOROOT
12:03 < exch> You can also just use 'import "foo"' and then add additional
search paths to the compiler/linker with the -I and -L flags
12:03 < exch> which, imho, is a cleaner solution
12:03 < Evesong> Ah, that's not what I meant though.  Sure, you can
explicitly import by filepath, but that makes your program non-portable.  I meant
specifying the default lookup path, not in the source code.
12:04 -!- sacho [~sacho@87-126-50-194.btc-net.bg] has quit [Read error: Connection
reset by peer]
12:04 < Evesong> Ah cool
12:04 < exch> yea, as said, the -L and -I compiler/linker flags
12:04 < Evesong> Thanks exch, your 2nd line answered it
12:05 < Evesong> Cool beans, no more questions for today I think, hehe.  :-)
12:05 < exch> :)
12:10 -!- xyproto [~alexander@77.40.159.131] has joined #go-nuts
12:11 -!- zerosanity [~josh@8.20.178.82] has joined #go-nuts
12:12 -!- jgonzalez [~jgonzalez@173-14-137-134-NewEngland.hfc.comcastbusiness.net]
has joined #go-nuts
12:12 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
12:12 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
12:16 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has quit [Quit:
Leaving.]
12:16 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has joined #go-nuts
12:21 -!- retybok [~retybok@gw.theralys.com] has joined #go-nuts
12:23 -!- kaichenxyz_ [~kaichenxy@115.199.111.22] has joined #go-nuts
12:26 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has quit [Ping
timeout: 246 seconds]
12:29 -!- niemeyer [~niemeyer@189-10-155-52.pltce701.dsl.brasiltelecom.net.br] has
joined #go-nuts
12:30 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 252
seconds]
12:35 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has quit [Ping
timeout: 276 seconds]
12:36 < plexdev> http://is.gd/qxNGlE by [Nigel Tao] in 2 subdirs of
go/src/pkg/ -- image/ycbcr: new package.
12:36 < GeertJohan> go's libs are really being developped right now right?
12:37 < GeertJohan> like, they're not all finished yet, right?
12:37 < xyproto> GeertJohan: that is correct
12:37 < xyproto> (afaik)
12:37 < GeertJohan> Is the syntax even final ?
12:37 < GeertJohan> or can that be changed too ?
12:37 < xyproto> ref http://code.google.com/p/go/source/list
12:38 < xyproto> GeertJohan: no, the syntax can be changed too (and are
changed occationally).  A Go-compiler that is a month or two old is considered
outdated.
12:38 < xyproto> Especially for reporting bugs.
12:38 < GeertJohan> cool :D
12:38 < retybok> Is the final goal to have something with "batteries
included", like python?
12:39 < xyproto> GeertJohan: both cool, and slightly frustrating, for people
writing library bindings, apps or books ;)
12:39 < TheMue_> (meta) Nothing will every be finished, everything can
change always.  (/meta)
12:39 < GeertJohan> when I followed the tutorials I didn't have the feeling
that this language was so much under development
12:39 < TheMue_> xyproto: My book is printed (and sells) and my libs grow.
And still no problem.
12:40 < GeertJohan> xyproto: agreed, offcourse its not a stable language to
start a large development project on.
12:40 < xyproto> retybok: I don't know if it's part of the masterplan to
include batteries, but it sure seems to be heading that way to me.
12:40 < GeertJohan> TheMue_: your book?  reference?
12:40 < xyproto> TheMue_: cool :)
12:40 < retybok> xyproto: thanks
12:40 < GeertJohan> TheMue: (amazon, for instance ;))
12:40 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has joined #go-nuts
12:41 < TheMue> Here's the book (http://amzn.to/emX68O) and here a site with
errata (http://go-for-it.mweb.de/).
12:41 < GeertJohan> ah its german only ?
12:42 < xyproto> TheMue: I dream about writing a book about Go some day as
well.  :) Any tips?
12:42 -!- TheMue_ [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has joined
#go-nuts
12:42 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Read
error: Connection reset by peer]
12:43 < TheMue> Yep, it's German.  We tried to find a US publisher, but
currently no luck.
12:43 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
12:43 < TheMue> Gna, my line is somehow instable today.
12:44 < TheMue> xyproto: I'll be back later (in about 5 to 6 hours).  Then
we could talk about writing.
12:44 < TheMue> Have to go into a meeting now.
12:45 -!- TheMue [~TheMue@wlan-hotspot-039.ewe-ip-backbone.de] has quit [Client
Quit]
12:48 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
12:50 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
12:57 -!- kaichenxyz [~kaichenxy@115.199.111.22] has quit [Remote host closed the
connection]
12:57 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has joined #go-nuts
12:57 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
12:59 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-157-72.clienti.tiscali.it] has
joined #go-nuts
13:00 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
13:00 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
13:03 -!- Project_2501 [~Marvin@82.84.93.109] has quit [Ping timeout: 258 seconds]
13:07 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 246 seconds]
13:09 -!- petrux [~petrux@host16-224-static.53-82-b.business.telecomitalia.it] has
quit [Ping timeout: 240 seconds]
13:10 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
joined #go-nuts
13:10 -!- crodjer [~rohanjain@203.110.240.205] has joined #go-nuts
13:21 -!- dave [~dfc@124-149-97-178.dyn.iinet.net.au] has joined #go-nuts
13:22 -!- dfc [~dfc@124-169-2-171.dyn.iinet.net.au] has quit [Ping timeout: 246
seconds]
13:23 -!- zimsim [~simon@87.72.77.195] has quit [Remote host closed the
connection]
13:24 -!- zimsim [~simon@87.72.77.195] has joined #go-nuts
13:29 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 246 seconds]
13:37 -!- gregschlom [~quassel@118.68.142.103] has joined #go-nuts
13:42 -!- iant [~iant@67.218.109.241] has joined #go-nuts
13:42 -!- mode/#go-nuts [+v iant] by ChanServ
13:48 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
13:51 -!- retybok [~retybok@gw.theralys.com] has quit [Quit: leaving]
13:59 -!- skelterjohn_ [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
14:00 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Read
error: Connection reset by peer]
14:05 -!- virtualsue [~chatzilla@nat/cisco/x-mamaqhwbmsxebvxx] has quit [Ping
timeout: 246 seconds]
14:06 < GeertJohan> go fixEveryonesInternetConnectionInThisChannel()
14:07 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
14:10 < fzzbt> how can i catch panics?
14:10 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
quit [Quit: gtaylor]
14:10 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
14:10 < exch> fzzbt: with defer and recover
14:10 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
joined #go-nuts
14:10 < exch> defer func() { if x := recover(); x != nil {
ohNoesAPanicHappened(x) } }()
14:11 -!- leczb [~leczb@nat/google/x-xcldrrghbaapoiim] has left #go-nuts
["Konversation terminated!"]
14:11 < fzzbt> i don't want to use defer
14:11 < exch> why not?
14:11 < fzzbt> because the call is deferred
14:11 -!- virtualsue [~chatzilla@nat/cisco/x-ckkouwsplctthgyz] has joined #go-nuts
14:11 < exch> you dont have to.  Just make sure that functions with recover
in it, is called on every exit point in the funciton you define it in
14:12 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Client
Quit]
14:14 < Namegduf> exch: You mean you don't have to use defer?  Because I'm
pretty sure you do, because normal execution isn't happening during a panic, so
normal exit points aren't passed over.
14:14 < exch> good point
14:15 * exch clearly needs more coffee before typing
14:16 < Namegduf> fzzbt: Your catching/recovering has to be deferred to when
the panic happens, when the deferred functions at each level are being run.
14:17 < Namegduf> You can't catch panics without returning from that
function.  You can use a wrapper function for that.  It isn't a common requirement
because defers are not used for regular error results.
14:17 < fzzbt> i just want to test whether my fancy function panics when i
want it to
14:18 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
14:20 < Namegduf> Use a function that takes a func() and a value of whatever
type it panics with, and returns a boolean.
14:20 < Namegduf> Have it defer a recover and check of the recovered value,
then call func()
14:21 < Namegduf> The defer sets the return value after recovering if the
panic value was as expected
14:21 < Namegduf> Otherwise it returns false
14:21 < Namegduf> Pass it a closure taking no parameters containing a call
to the thing you want to test.
14:22 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
14:23 < Namegduf> A slightly smarter wrapper which lets you just if
!expectedPanic(func() { blah(x, y) }, boomValue) {
14:25 -!- dfr|mac_ [~dfr|work@ool-182e3fca.dyn.optonline.net] has joined #go-nuts
14:28 -!- emjayess [~emjayess@pix1.i29.net] has joined #go-nuts
14:30 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has quit [Quit:
Leaving.]
14:31 < xyproto> fzzbt: you can wrap the code that may fail in another
function, that has it's own defer
14:31 < xyproto> *its
14:35 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
14:35 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has left
#go-nuts []
14:37 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
14:37 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has left
#go-nuts []
14:37 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
14:39 -!- tobier [~tobier@c-1e9de055.712-1-64736c11.cust.bredbandsbolaget.se] has
quit [Read error: Connection reset by peer]
14:41 -!- tobier [~tobier@c-1e9de055.712-1-64736c11.cust.bredbandsbolaget.se] has
joined #go-nuts
14:49 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has quit
[Quit: jscherer26]
14:51 < ognom> How do I remove null-padding from a string the easiest way?
14:53 < plexdev> http://is.gd/UeZ48q by [Gustavo Niemeyer] in
go/src/pkg/crypto/openpgp/armor/ -- openpgp: Fix improper := shadowing
14:54 < fzzbt> okay got it working
14:54 < fzzbt> thank you all
14:54 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
14:54 < fzzbt> maybe gocheck should have methods for checking panics
14:56 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has left
#go-nuts []
14:56 < Namegduf> ognom: If you know how long the padding is at the time you
get the string, you can say s = s[:realLength]
14:57 -!- tensai_cirno [~cirno@77.232.15.216] has joined #go-nuts
14:57 -!- iant [~iant@67.218.109.241] has quit [Quit: Leaving.]
14:58 < ognom> That's the problem, the padding varies so I need some way to
remove all the padding which varies from string to string
14:59 -!- Venom_X [~pjacobs@75-27-133-72.lightspeed.austtx.sbcglobal.net] has
joined #go-nuts
14:59 -!- zimsim [~simon@87.72.77.195] has quit [Read error: Operation timed out]
14:59 -!- zimsim [~simon@87.72.77.195] has joined #go-nuts
15:02 -!- jnwhiteh [~jnwhiteh@li37-84.members.linode.com] has quit [Changing host]
15:02 -!- jnwhiteh [~jnwhiteh@WoWUIDev/WoWI/Featured/Dongle/cladhaire] has joined
#go-nuts
15:04 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has joined #go-nuts
15:07 < skelterjohn> morning
15:08 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
15:09 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has left
#go-nuts []
15:09 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has joined
#go-nuts
15:09 -!- jscherer26 [~jscherer2@d199-74-181-32.try.wideopenwest.com] has left
#go-nuts []
15:10 -!- Project_2501 [~Marvin@82.84.75.155] has joined #go-nuts
15:10 -!- GilJ_ [~GilJ@zeus.ugent.be] has quit [Quit: leaving]
15:10 < fzzbt> ha, i found a case where gofmt breaks my perfectly working
code by removing "extra" parens from it which are actually required.
15:11 < uriel> fzzbt: fill a bug?  but sounds rather strange
15:12 < uriel> gofmt should certainly not break any valid program
15:13 < fzzbt> http://pastie.org/1787217
15:13 < fzzbt> now i get: utils_test.go:29: syntax error: unexpected {,
expecting ( etc.
15:13 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-157-72.clienti.tiscali.it] has
quit [Ping timeout: 260 seconds]
15:13 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
15:15 < fzzbt> okay, maybe using function literals like that is dumb, but
still..
15:15 < uriel> dumb or not, if the input is valid, I think gofmt should
always produce valid output
15:15 < uriel> at least that is my understanding
15:17 < fzzbt> i'll file a bug
15:18 < delinka> I see paren mismatch in the paste
15:19 < fzzbt> hmm?
15:19 < skelterjohn> i don't
15:19 < delinka> the ( after the if is closed where?
15:19 < fzzbt> it removed the parens from if-statement
15:19 < skelterjohn> many lines later
15:19 < skelterjohn> line 31
15:19 < skelterjohn> i mean
15:19 < skelterjohn> 14
15:20 < delinka> ah.  my client puts 10 lines inline.  I probably should
have followed the link.
15:23 -!- Project_2501 [~Marvin@82.84.75.155] has quit [Read error: Operation
timed out]
15:33 -!- piranha [~piranha@D57D1AB3.static.ziggozakelijk.nl] has quit [Quit:
Computer has gone to sleep.]
15:36 -!- dfr|mac_ [~dfr|work@ool-182e3fca.dyn.optonline.net] has quit [Remote
host closed the connection]
15:40 -!- pharris [~Adium@rhgw.opentext.com] has joined #go-nuts
15:40 -!- Fish-- [~Fish@coss6.exosec.net] has quit [Quit: So Long, and Thanks for
All the Fish]
15:40 -!- Fish [~Fish@exo3753.pck.nerim.net] has joined #go-nuts
15:41 -!- joelkronander [~joelkrona@130.236.243.164] has quit [Quit:
joelkronander]
15:49 -!- firwen [~firwen@adevlaptop.cern.ch] has quit [Remote host closed the
connection]
15:53 < fzzbt> oh great, go's google code's issue reporting thing gave me an
error message when i tried to sent my issue, so i thought it didn't go through, so
i decided to retry sending 3 more times.  now, there's 4 duplicates of the same
and i can't remove them ...
15:55 < exch> oops :p
15:55 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
15:55 < skelterjohn> lol
15:55 < skelterjohn> now they're all going to hate you
15:55 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has quit [Read error:
Operation timed out]
15:57 < skelterjohn> they all hate me already, so you're not alone
15:58 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
15:58 < fzzbt> ;)
15:59 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
16:02 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has joined #go-nuts
16:06 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
16:07 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
16:08 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
16:09 -!- virtualsue [~chatzilla@nat/cisco/x-ckkouwsplctthgyz] has quit [Ping
timeout: 240 seconds]
16:09 -!- iant [~iant@nat/google/x-mqtvirgugmdedmol] has joined #go-nuts
16:09 -!- mode/#go-nuts [+v iant] by ChanServ
16:10 -!- GeertJohan [~Squarc@D978EC5D.cm-3-1d.dynamic.ziggo.nl] has joined
#go-nuts
16:10 < GeertJohan> Hi all :)
16:13 < GeertJohan> void...
16:14 -!- jesusaurus1 [jesusaur@firefly.cat.pdx.edu] has left #go-nuts ["WeeChat
0.3.2"]
16:15 < exch> lo
16:22 -!- keithcascio [~keithcasc@nat/google/x-jjatbbcqsqeeynwg] has joined
#go-nuts
16:24 -!- rurban [~demo@178-191-156-58.adsl.highway.telekom.at] has joined
#go-nuts
16:28 -!- zozoR [~Morten@56344b27.rev.stofanet.dk] has joined #go-nuts
16:41 < plexdev> http://is.gd/hnnwtj by [Brad Fitzpatrick] in
go/src/pkg/http/ -- http: client gzip support
16:41 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-155-53.clienti.tiscali.it] has
joined #go-nuts
16:42 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
16:46 -!- boscop__ [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
16:46 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
16:47 -!- firwen [~firwen@146.123.98-84.rev.gaoland.net] has joined #go-nuts
16:48 -!- bjarneh [~bjarneh@1x-193-157-193-225.uio.no] has joined #go-nuts
16:50 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
16:50 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Ping
timeout: 260 seconds]
16:51 -!- zerosanity [~josh@8.20.178.82] has quit [Read error: Connection reset by
peer]
16:51 -!- boscop__ [~boscop@g230090246.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
16:52 -!- zerosanity [~josh@8.20.178.82] has joined #go-nuts
16:52 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
16:55 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
16:56 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
16:57 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
16:57 -!- snearch [~snearch@f053012201.adsl.alicedsl.de] has joined #go-nuts
16:59 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has quit [Excess Flood]
17:00 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
17:02 -!- scyth_ [~scyth@194.247.195.133] has joined #go-nuts
17:02 -!- tav [~tav@92.7.142.193] has quit [Read error: Connection reset by peer]
17:03 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-159-138.clienti.tiscali.it] has
joined #go-nuts
17:04 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
17:05 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-155-53.clienti.tiscali.it] has
quit [Read error: Operation timed out]
17:06 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
17:07 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
17:09 -!- nixness [~dsc@dyn-86-36-43-184.wv.qatar.cmu.edu] has joined #go-nuts
17:10 -!- boscop_ [~boscop@g230090246.adsl.alicedsl.de] has quit [Ping timeout:
248 seconds]
17:12 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
17:12 -!- tav [~tav@92.7.142.193] has joined #go-nuts
17:13 -!- firwen [~firwen@146.123.98-84.rev.gaoland.net] has quit [Ping timeout:
260 seconds]
17:19 -!- araujo [~araujo@190.38.51.34] has joined #go-nuts
17:19 -!- araujo [~araujo@190.38.51.34] has quit [Changing host]
17:19 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
17:20 < Glasswalker> If I have a large byte array, and I want to insert
other smaller byte arrays into it at fixed locations.  Can I simply use a slice to
identify it, and insert to that slice?
17:20 < Glasswalker> like bigbuf[1000:2000] = smallbuf
17:21 <+iant> no, you can't use a slice on the left hand side of an
assignment
17:21 <+iant> you have to use the copy builtin function
17:22 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
17:23 < skelterjohn> Glasswalker: as in, copy(bigbuf[1000:2000], smallbuf)
17:23 -!- saschpe [~quassel@opensuse/member/saschpe] has quit [Remote host closed
the connection]
17:24 < Glasswalker> was just looking that up :)
17:24 < exch> 'bigbuf[1000:2000] = smallbuf' is a bit ambiguous..  Should it
remove all 1k elements and replace with whatever smallbuf contains Or just replace
len(smallbuf) elements and leave the rest intact?
17:24 < exch> what if smallbuf is larger than 1k
17:24 < Glasswalker> hmm
17:24 < Glasswalker> good point
17:25 < Glasswalker> in my case I want it to explicitly replace the range
with the contents of smallbuf
17:25 < Glasswalker> smallbuf should never be longer in this case (I'm doing
checking on that to be sure)
17:25 < Glasswalker> if smallbuf is full of nulls, it should replace all
1000 with null
17:25 < Glasswalker> but smallbuf should never be smaller either
17:26 < Glasswalker> the reason I know this is I'm calculating the length of
the slice based on smallbuf
17:26 < exch> k
17:26 < Glasswalker> in otherwords it actually looks like
bigbuf[1000:1000+len(smallbuf)] = smallbuf
17:26 < Glasswalker> and len bigbuf is allways 1000+len(smallbuf)
17:26 < skelterjohn> i don't know what happens if you give copy two slices
of different length
17:27 < skelterjohn> presumably something sensible
17:27 < Glasswalker> ok cool
17:27 < Glasswalker> thanks
17:27 -!- kaichenxyz [~kaichenxy@li261-87.members.linode.com] has quit [Ping
timeout: 246 seconds]
17:27 < skelterjohn> Glasswalker: if you know that, you can say
bigbuf[1000:] instead of bigbuf[1000:1000+len(smallbuf)]
17:27 < skelterjohn> omitting the index means 0 or len(theslice), depending
on which index you omit
17:28 -!- arun_ [~arun@unaffiliated/sindian] has quit [Ping timeout: 246 seconds]
17:30 -!- Fish- [~Fish@9fans.fr] has joined #go-nuts
17:33 -!- GilJ [~GilJ@zeus.ugent.be] has joined #go-nuts
17:34 -!- snearch [~snearch@f053012201.adsl.alicedsl.de] has quit [Quit:
Verlassend]
17:35 -!- Adys [~Adys@unaffiliated/adys] has quit [Quit: Quit]
17:47 -!- alexandere [~alexander@eijg.xs4all.nl] has joined #go-nuts
17:50 -!- tvw [~tv@212.79.9.150] has quit [Remote host closed the connection]
17:53 -!- krutcha [~krutcha@remote.icron.com] has joined #go-nuts
17:57 -!- Evesong [~evesong@ruby.nanocore.co.uk] has quit [Quit: Leaving]
17:57 -!- Adys [~Adys@unaffiliated/adys] has joined #go-nuts
17:58 < plexdev> http://is.gd/Ito9UB by [Rob Pike] in go/ -- C+A: Add Lucio
De Re
17:59 < ww> skelterjohn, Glasswalker i believe it will copy as much as it
can and truncate
17:59 < skelterjohn> right - the only sensible thing possible (besides
giving up entirely)
18:04 < Glasswalker> here is a general question about types...  If I have a
type call it "A" which has several fields and methods...  Then I create a type B
with: "type B A{newfield bool
18:04 < Glasswalker> didn't mean to hit enter there lol
18:04 < Glasswalker> "type B A{newfield bool}"
18:05 < Glasswalker> and add a new method to it
18:05 < Glasswalker> if I have a value of type B, will it be able to access
all of Type A's fields, and methods?  (common inheritance)
18:05 < Glasswalker> that's what I would expect, just checking
18:05 < ww> you mean "type B struct { A; newfield bool }" right?
18:05 < Glasswalker> as I haven't done any kind of inheritance in Go yet.
18:05 < ww> yes it wil inherit the methods
18:06 < Glasswalker> ahh see I had the syntax wrong
18:06 < ww> and you can override them as you would expect
18:06 < Glasswalker> I assumed struct was the type it was inheriting from
18:06 < Glasswalker> ok
18:06 < Glasswalker> so yeah that's what I needed to know
18:06 < Glasswalker> thanks
18:06 < ww> np!
18:07 < Glasswalker> do I need to do anything special to override?  or just
re-implement them and the new one in B will naturally override A
18:08 < skelterjohn> just give them the same names
18:08 < Glasswalker> ok cool
18:08 < skelterjohn> but just in case - this does *not* give any kind of
polymorphism
18:08 -!- aconran_ [~aconran-o@38.104.129.126] has quit [Ping timeout: 258
seconds]
18:09 < skelterjohn> if you turn a *B into a *A, the "overridden" methods
don't make any difference
18:09 < skelterjohn> it will use A's methods
18:09 < Glasswalker> ok
18:09 < Glasswalker> basically I have a struct for Packet, which contains a
size, and a payload (among other data).  The packet has methods for encrypting,
decrypting, and transmitting/recieving (as well as checksums and all that)
18:10 < Glasswalker> I want to now break out into different types of
packets.  Which will add an Encode and Decode method
18:10 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
18:10 < Glasswalker> allowing the added fields specific to the new type to
be encoded into the payload, or decoded from the payload
18:10 -!- aconran [~aconran-o@38.104.129.126] has joined #go-nuts
18:10 < Glasswalker> other than that it can be treated as a normal packet
18:11 < skelterjohn> then you'll want to define an interface
18:11 < Glasswalker> so I could create a new packet_connect for example,
which contains auth data...  Then run p.Encode() then from that point forward
treat it as a normal packet, since the data is all encoded into the Payload at
that point (a field of the base packet)
18:11 < skelterjohn> type PacketEncorder interface { encode(stuff) }
18:11 < skelterjohn> or something similar
18:12 < Glasswalker> Why?
18:12 < Glasswalker> the encoder/decoder are all specific to the individual
packet types
18:12 < Glasswalker> as they all have completely different formats for the
payload
18:12 < skelterjohn> presumably you want something that can take any one of
these packet types and encode them
18:12 -!- nixness [~dsc@dyn-86-36-43-184.wv.qatar.cmu.edu] has quit [Quit:
Leaving]
18:13 < Glasswalker> not really
18:13 < Glasswalker> I already have all the pieces in place for packet
transmission, recieving and all the supporting parts
18:13 < skelterjohn> ok, well you know the context better than i do
18:13 < Glasswalker> I plan on having factory functions for each packet type
18:13 < skelterjohn> i'm not great at internalizing the entire problem over
IRC
18:13 < Glasswalker> NewConnectPacket() for example
18:14 < Glasswalker> which I pass all the useful details for a Connect
Packet for example.  It then returns a ConnectPacket type
18:14 < Glasswalker> already assembled and encoded
18:14 < Glasswalker> (using the ConnectPacket.Encode() method, which is
unique to the ConnectPacket type)
18:14 -!- arun_ [~arun@unaffiliated/sindian] has joined #go-nuts
18:14 < Glasswalker> the same goes for NewDisconnectPacket() and so on
18:14 -!- arun__ [~arun@i172010.upc-i.chello.nl] has joined #go-nuts
18:15 < Glasswalker> all of those packet types inherit from the main Packet
type, which is used in all the transmission and reciept code
18:15 < Glasswalker> and encryption code and so on
18:15 < plexdev> http://is.gd/7TXFe0 by [Lucio De Re] in go/src/cmd/ld/ --
ld: ELF header function declarations.
18:15 -!- arun__ [~arun@i172010.upc-i.chello.nl] has quit [Read error: Connection
reset by peer]
18:15 < plexdev> http://is.gd/RpGvSm by [Rob Pike] in go/src/pkg/fmt/ --
fmt: allow %U for unsigned integers.
18:15 < skelterjohn> "inherit" is the wrong word
18:15 < skelterjohn> but correct me if i'm wrong:
18:15 < skelterjohn> you have a function that takes a *Packet, serializes it
and sends it over the wire?
18:15 < Glasswalker> yes
18:16 < Glasswalker> that is a method on the Packet
18:16 < Glasswalker> (Packet.TyBytes() to be exact)
18:16 < Glasswalker> err ToBytes
18:16 < skelterjohn> and you define Packet.ToBytes(), ok
18:16 < skelterjohn> and you also define DisconnectPacket.ToBytes()?
18:17 < Glasswalker> no
18:17 < Glasswalker> I want DisconnectPacket to use the Packet.ToBytes
18:18 < Glasswalker> since from the perspective of ToBytes it's only
encoding the payload
18:18 < Glasswalker> which is just a big byte array already
18:18 < Glasswalker> (and the other packet header data)
18:18 < Glasswalker> the DisconnectPacket.Encode encodes all the
DisconnectPacket specific stuff into the packet.Payload byte array
18:18 < Glasswalker> so it's ready for transmission by the Packet methods
18:18 < skelterjohn> is there any code that refers to something that might
be one of several different types of packets?
18:19 < Glasswalker> yes...  all of the Packet methods
18:19 < Glasswalker> but as I said all they care about are the header and
payload
18:19 < Glasswalker> (ignoring all other data)
18:20 < Glasswalker> hold on, I can post some code to show examples
18:20 < skelterjohn> something external to packets
18:20 < skelterjohn> presumably there is some kind of event loop somewhere
18:20 < Glasswalker> right
18:20 < Glasswalker> but it's only dealing with the Packet type
18:21 < Glasswalker> (for transmission and reciept on the wire)
18:21 < Glasswalker> Ah
18:21 < Glasswalker> think I see it now
18:21 < Glasswalker> so once the packet is received, it needs to turn it
into it's appropriate packet type
18:21 < Glasswalker> the packet has a header in it
18:22 < Glasswalker> which has a single byte "Command" which identifies the
type of packet
18:22 < Glasswalker> along with other header data
18:22 < Glasswalker> so I was planning on reading the command, and then
creating a new packet of whatever type is relevant
18:22 < Glasswalker> then running a decode on that new packet type, to read
the useful data out of the payload
18:22 < Glasswalker> so basically turn the Packet into a DisconnectPacket
for example
18:23 < skelterjohn> but then what do you give this DisconnectPacket to
18:23 < Glasswalker> there are no central handlers for the various packet
types
18:23 -!- fabled [~fabled@83.145.235.194] has quit [Quit: Ex-Chat]
18:23 < skelterjohn> ok
18:23 < Glasswalker> each has it's own function
18:23 < Glasswalker> the packets are only a transport medium
18:23 < Glasswalker> they are assembled into envelopes
18:23 < Glasswalker> which contain a message
18:23 < Glasswalker> the messages are what I act on
18:24 < Glasswalker> right now I'm writing the underlying transport
18:24 < Glasswalker> so a packet can either be a connect, disconnect,
header, footer, data, retransmit, envelope_ack
18:24 < Glasswalker> connect gets handled during the initial connection by
the client, to authenticate
18:25 < Glasswalker> header triggers creation of a new envelope with the
appropriate header data
18:25 < Glasswalker> data get fed into an envelope until a footer is
recieved
18:25 < Glasswalker> the footer contains checksum data
18:25 < Glasswalker> if the envelope checks out clean
18:25 < Glasswalker> then an envelopeack is sent
18:25 < Glasswalker> otherwise a retransmit is sent with the
18:25 < Glasswalker> err
18:25 < Glasswalker> with the data packets that it needs re-sent
18:25 < Glasswalker> or a flag saying retransmit the entire envelope
18:25 < Glasswalker> depending on the error type
18:26 < Glasswalker> once a complete envelope is recieved, it is checksummed
and such
18:26 < Glasswalker> and provided it is complete and clean, it is decoded
into a message
18:26 < Glasswalker> the message is then routed based on the routing rules
on the message
18:26 < Glasswalker> (I'm writing a message bus system)
18:26 < Glasswalker> so it doesn't care about the actual content of the
message
18:27 < Glasswalker> just how to route it to the other connected clients
18:27 < skelterjohn> and by route, you mean send over a different wire?
18:27 < skelterjohn> rather than call-a-handler-function?
18:27 < Glasswalker> right
18:27 < Glasswalker> there is a client object
18:27 < skelterjohn> ok, should be fine then
18:28 < Glasswalker> and it contains a UID, class, and subclass
18:28 < Glasswalker> those are used for routing
18:28 < Glasswalker> you can send a message with the following routing
types: system, broadcast, class, subclass, direct
18:28 < Glasswalker> direct goes to a specific UID, broadcast goes to all
connected clients, class goes to all clients of a specific class and so on
18:29 < Glasswalker> there is a bit more logic than that to it, because
multiple servers can network, and routing can bounce through multiple servers...
but that is handled by a client array at each end, and a distributed registry
18:30 < skelterjohn> (tmi) :)
18:30 < Glasswalker> lol
18:30 < Glasswalker> sorry :)
18:30 < Glasswalker> I have a tendency to be a bit verbose when I get going
;)
18:30 -!- tvw [~tv@e176006168.adsl.alicedsl.de] has joined #go-nuts
18:31 -!- gregschlom [~quassel@118.68.142.103] has quit [Ping timeout: 246
seconds]
18:33 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
quit [Read error: Connection reset by peer]
18:33 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
joined #go-nuts
18:35 -!- TheMue [~TheMue@p5DDF5B02.dip.t-dialin.net] has joined #go-nuts
18:35 -!- skelterjohn_ [~jasmuth@lawn-gw.rutgers.edu] has joined #go-nuts
18:35 < skelterjohn_> happens to me all the time
18:35 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has quit [Read error: No
route to host]
18:40 -!- Caphalor90 [~heandreas@dslb-088-075-140-241.pools.arcor-ip.net] has
joined #go-nuts
18:41 -!- Caphalor90 [~heandreas@dslb-088-075-140-241.pools.arcor-ip.net] has quit
[Client Quit]
18:41 -!- artefon [~thiago@dhcp10.usuarios.dcc.ufmg.br] has quit [Ping timeout:
240 seconds]
18:42 -!- aiju [~aiju@unaffiliated/aiju] has quit [Quit: ZNC -
http://znc.sourceforge.net]
18:43 -!- aiju [~aiju@unaffiliated/aiju] has joined #go-nuts
18:45 < ww> Glasswalker: sounds to me like you want type Packet interface {
Encode() []byte }
18:45 < ww> curious: what sort of protocol is this you are implementing?
18:46 -!- alexandere [~alexander@eijg.xs4all.nl] has quit [Quit: alexandere]
18:50 -!- gregschlom [~quassel@118.68.142.103] has joined #go-nuts
18:52 -!- awidegreen [~quassel@c-cfc5e555.08-2-73746f39.cust.bredbandsbolaget.se]
has joined #go-nuts
18:54 -!- artefon [~thiago@bananal.lbd.dcc.ufmg.br] has joined #go-nuts
18:57 -!- Venom_X [~pjacobs@75-27-133-72.lightspeed.austtx.sbcglobal.net] has quit
[Quit: Venom_X]
19:00 -!- gregschlom [~quassel@118.68.142.103] has quit [Ping timeout: 246
seconds]
19:06 -!- awidegreen [~quassel@c-cfc5e555.08-2-73746f39.cust.bredbandsbolaget.se]
has quit [Read error: Operation timed out]
19:08 -!- awidegreen [~quassel@c-cfc5e555.08-2-73746f39.cust.bredbandsbolaget.se]
has joined #go-nuts
19:09 -!- huin [~huin@91.85.185.181] has joined #go-nuts
19:10 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has joined #go-nuts
19:14 -!- boscop [~boscop@g230090246.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
19:17 -!- fabled [~fabled@83.145.235.194] has joined #go-nuts
19:20 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
19:29 -!- wrtp [~rog@92.17.67.64] has quit [Quit: wrtp]
19:30 -!- wrtp [~rog@92.17.67.64] has joined #go-nuts
19:34 < skelterjohn> anyone here know about doing basic os x windowing work
from C (rather than objC)?
19:36 -!- Surma [~surma@g230118190.adsl.alicedsl.de] has joined #go-nuts
19:38 < Surma> Hey guys.  How come, that if I unmarshall a number from
JSON-string into a int64, it fails the second the number has 7 digits?
19:38 < Surma> The error just says, that the number doesn't can't be
umarshalled into a go value of that type (i.e.  int64)
19:40 < skelterjohn> should be allowed approx 63/3 digits
19:41 < skelterjohn> can you give me the number that failed?
19:44 < Surma> any 6-digit numer succeeds, any 7-digit number fails
19:44 < Surma> well, I didn't test *any* number, but bunch of both ;)
19:44 < skelterjohn> you've tried them all, have you?  :)
19:45 < skelterjohn> can you make a pastebin that will demonstrate the
failure?
19:47 < skelterjohn> this works fine: http://pastebin.com/2JhfjSme
19:47 < skelterjohn> i suspect the problem is elsewhere
19:48 < skelterjohn> can you paste the exact error text?
19:48 < skelterjohn> since it includes both the number and the type you're
trying to put it into
19:48 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has joined #go-nuts
19:49 < skelterjohn> i can fit a 19 digit number into an int64
19:50 < skelterjohn> the exact bound is at 2^63
19:50 < skelterjohn> i can fit 2^63-1, but not 2^63
19:50 < Surma> That's what I thought, that's why I'm so confused
19:50 < skelterjohn> so paste your code
19:50 < skelterjohn> the error is somewhere else
19:50 < Surma> well, let me see if I can extract an demonstration
19:51 < Surma> it's big, so lemme strip it down first
19:51 -!- PortatoreSanoDiI [~Marvin@dynamic-adsl-94-36-161-78.clienti.tiscali.it]
has joined #go-nuts
19:51 < skelterjohn> then paste the exact error message
19:51 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 252 seconds]
19:51 < Surma> json: cannot unmarshal number 1.83456e+06 into Go value of
type int64
19:52 < skelterjohn> it's probably choking on the e+ notation
19:53 < Surma> That's not how I wrote the number
19:53 < skelterjohn> certainly if you convert it to 1834560, it works
19:53 -!- emjayess [~emjayess@pix1.i29.net] has quit [Quit: Leaving]
19:53 < Surma> That conversion is happening implicitely somewhere
19:53 < Surma> Yeah, I saw that from your testcase
19:53 < skelterjohn> fmt.Sprintf might do that
19:53 < Surma> I guess it failes because I'm using reflections in the
process
19:53 < skelterjohn> json.Marshal won't
19:54 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-159-138.clienti.tiscali.it] has
quit [Ping timeout: 258 seconds]
19:55 < Surma> hm
19:56 < Surma> so basically, I'm umarshalling into a pointer of an int64,
but it's passed as an interface{} due to reflections
19:56 < skelterjohn> that's fine
19:56 < Surma> I'll try to write a small test
19:56 < skelterjohn> the fact that it is passed as an interface is
irrelevant
19:56 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.4]
19:57 < skelterjohn> it's the fact that the data you are unmarshalling from
uses exponential notation
19:57 < skelterjohn> find out what is creating that string
19:57 < skelterjohn> or []byte, i mean
19:58 < Surma> I checked, it's not exponential notation
19:59 < skelterjohn> print out the data right before you try to unmarshal it
20:00 < skelterjohn> it has to be getting "1.83456e+06" from somewhere, and
the only place it can be is the []byte you pass into json.Unmarshal
20:01 < Surma> ah, i got it
20:02 < Surma> Well, the explanation is a bit longer:
20:03 < Surma> So I know I get an array of some stuff, so I unmarshall it
into an []interface{}.  Then I marshall each of the elements back into string
form.  SO effectively I parse an json-string to []json-string.  However,
unmarshalling a number into an nil-interface{} makes the json package use float64,
hence the exponential notation at the actual unmarshalling stage
20:04 < Surma> damn, now I realize how stupid this layout is ^^
20:06 < skelterjohn> didn't really follow that, but glad you got it working
20:12 < Surma> well short-version: I unmarshalled into an nil-interface, and
then marshalled back which introduced the exponential notation
20:14 < skelterjohn> how can you unmarshal into a nil interface?
20:15 < skelterjohn> i get "json: Unmarshal(nil)" as an error
20:15 -!- zozoR [~Morten@56344b27.rev.stofanet.dk] has quit [Remote host closed
the connection]
20:22 < hopso> Anyone got ideas on a simple(ish) distributed computing
application to get my hands dirty with?
20:23 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has quit [Ping
timeout: 246 seconds]
20:23 < skelterjohn> hows your linear algebra?
20:24 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
20:24 < hopso> Ok, I guess.  Been a while since I used it last time.
20:25 < huin> is it safe to remove items from a map as it's being iterated
over?
20:25 < huin> specifically removing the "current" item
20:25 < skelterjohn> huin: not threadsafe
20:25 < huin> that's fine
20:25 < skelterjohn> oh i see
20:25 < skelterjohn> i think so
20:26 < huin> excellent.  that makes life easier
20:29 < hopso> skelterjohn: Why you asked about linear algebra?
20:29 < aiju> huin: i don't think so
20:29 < huin> arg :(
20:30 < skelterjohn> hopso: oh right.  if you want you can take a look at
gomatrix.googlecode.com and see if you can make some of the more fun algorithms in
there concurrent
20:30 < skelterjohn> aiju: how sure are you?
20:30 * huin tries some code out
20:30 < huin> thing that worries me is that even if it works in test code, i
don't know if that's just luck
20:30 < aiju> skelterjohn: somewaht
20:30 < hopso> skelterjohn: I'll check it, thanks.
20:31 < skelterjohn> hopso: I already did straight matrix multiplication,
but it could probably be improved
20:32 < aiju> okay, it seems to work here
20:32 -!- bjarneh [~bjarneh@1x-193-157-193-225.uio.no] has quit [Quit: leaving]
20:33 < aiju> weird things happen if you *insert* elements
20:33 < plexdev> http://is.gd/ICfuu8 by [Lucio De Re] in go/src/cmd/8l/ --
8l: correct Plan 9 compiler warnings
20:34 < skelterjohn> aiju: right - then it's not clear if they should be
iterated over on the current shot, or not.  my guess would be "depending on where
they got inserted"
20:34 < huin> yeah seems to work for me as well
20:34 < huin> removal at least
20:35 < aiju> skelterjohn: *really* strange things happen
20:35 < skelterjohn> heh ok
20:36 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
20:37 < huin> sounds fun :D
20:37 < skelterjohn> huin: read WoT at all?
20:38 < huin> not heard of it
20:38 < skelterjohn> nvm
20:41 -!- Adys [~Adys@unaffiliated/adys] has quit [Quit: Quit]
20:43 < scyth_> hey, in I/O 2010 session with Rob and Russ (Go Programming),
they made an example of load balancer
20:43 < scyth_> is there a code available from that session?
20:47 -!- zerosanity [~josh@8.20.178.82] has quit [Remote host closed the
connection]
20:48 -!- cafesofie [~cafesofie@ool-4a5a6ee5.dyn.optonline.net] has joined
#go-nuts
20:51 -!- iant [~iant@nat/google/x-mqtvirgugmdedmol] has quit [Ping timeout: 252
seconds]
20:54 -!- iant [~iant@216.239.45.19] has joined #go-nuts
20:54 -!- mode/#go-nuts [+v iant] by ChanServ
20:56 -!- joelkronander
[~joelkrona@c-bf2fe253.617-1-64736c22.cust.bredbandsbolaget.se] has joined
#go-nuts
20:58 -!- iant1 [~iant@nat/google/x-nmboofmcpnjuhdfs] has joined #go-nuts
21:00 -!- iant [~iant@216.239.45.19] has quit [Ping timeout: 240 seconds]
21:01 -!- huin [~huin@91.85.185.181] has quit [Quit: bed]
21:02 -!- Surma [~surma@g230118190.adsl.alicedsl.de] has left #go-nuts []
21:04 -!- TheMue [~TheMue@p5DDF5B02.dip.t-dialin.net] has quit [Quit: TheMue]
21:07 -!- aconran [~aconran-o@38.104.129.126] has quit [Read error: Operation
timed out]
21:08 < hopso> scyth_: Doesn't the session video have some code and a good
explanation on how it works?
21:09 < hopso> It was pretty clearly explained if I recall correctly.
21:09 < scyth_> yes
21:10 < scyth_> but I'm more interested in other surrounding stuff
(scheduling 100 requesters, setting up workers)
21:10 < scyth_> using heap to balance the requests is all clear
21:10 -!- zimsim [~simon@87.72.77.195] has quit [Quit: /dev/null]
21:13 < skelterjohn> hopso: any interest in the gomatrix stuff?
21:14 < scyth_> brb
21:14 -!- scyth_ [~scyth@194.247.195.133] has quit [Quit: Leaving]
21:14 -!- Fish- [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
Fish]
21:17 < hopso> Yep, looks interesting.  I'll need a quick refresher about
linear algebra, though.
21:28 -!- aconran [~aconran-o@38.104.129.126] has joined #go-nuts
21:34 -!- m4dh4tt3r [~Adium@c-69-181-223-245.hsd1.ca.comcast.net] has joined
#go-nuts
21:38 -!- aconran [~aconran-o@38.104.129.126] has quit [Ping timeout: 258 seconds]
21:42 -!- artefon [~thiago@bananal.lbd.dcc.ufmg.br] has quit [Quit: bye]
21:45 -!- rurban [~demo@178-191-156-58.adsl.highway.telekom.at] has quit [Ping
timeout: 276 seconds]
21:46 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
21:47 -!- gtaylor [~gtaylor@99-126-136-139.lightspeed.gnvlsc.sbcglobal.net] has
quit [Quit: gtaylor]
21:49 -!- wrtp [~rog@92.17.67.64] has quit [Quit: wrtp]
21:52 -!- aconran [~aconran-o@38.104.129.126] has joined #go-nuts
21:55 -!- napsy [~luka@88.200.96.18] has quit [Ping timeout: 276 seconds]
21:57 -!- GeertJohan [~Squarc@D978EC5D.cm-3-1d.dynamic.ziggo.nl] has quit [Quit:
Leaving.]
21:57 -!- JusticeFries [~JusticeFr@173-8-247-218-Colorado.hfc.comcastbusiness.net]
has joined #go-nuts
21:58 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
21:59 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
21:59 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Client
Quit]
22:01 -!- awidegreen [~quassel@c-cfc5e555.08-2-73746f39.cust.bredbandsbolaget.se]
has quit [Remote host closed the connection]
22:11 < exch>
http://google-opensource.blogspot.com/2011/04/introducing-cityhash.html
22:11 < ttblrs_> google ist still programming c++?
22:14 < scyth> :)
22:19 < krutcha> maybe the real world can still bind to it from javascript
to do some heavy lifting in datacenters in farmville or something
22:31 -!- hopso [~hopso@a91-152-176-165.elisa-laajakaista.fi] has left #go-nuts []
22:31 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
22:36 -!- nixness [~dsc@78.100.166.168] has joined #go-nuts
22:37 -!- Guest47288 [~dfc@124-149-97-178.dyn.iinet.net.au] has quit [Quit:
Guest47288]
22:40 -!- nixness [~dsc@78.100.166.168] has quit [Client Quit]
22:45 -!- virtualsue [~chatzilla@nat/cisco/x-gjqeacbkdzdscegd] has joined #go-nuts
22:49 -!- katakuna [pie@kjal.demon.co.uk] has quit [Ping timeout: 260 seconds]
22:52 -!- taruti [taruti@ultra.violetti.org] has quit [Ping timeout: 248 seconds]
22:53 -!- nixness [~dsc@78.100.166.168] has joined #go-nuts
22:53 -!- iant1 [~iant@nat/google/x-nmboofmcpnjuhdfs] has quit [Quit: Leaving.]
23:04 -!- skelterjohn [~jasmuth@lawn-gw.rutgers.edu] has quit [Quit: skelterjohn]
23:06 -!- virtualsue [~chatzilla@nat/cisco/x-gjqeacbkdzdscegd] has quit [Ping
timeout: 248 seconds]
23:10 -!- taruti [taruti@ultra.violetti.org] has joined #go-nuts
23:12 -!- iant [~iant@nat/google/x-wdtveliuwkqzpmyh] has joined #go-nuts
23:12 -!- mode/#go-nuts [+v iant] by ChanServ
23:21 -!- Adys [~Adys@unaffiliated/adys] has joined #go-nuts
23:29 -!- iant [~iant@nat/google/x-wdtveliuwkqzpmyh] has quit [Quit: Leaving.]
23:31 -!- dfc [~dfc@eth59-167-133-99.static.internode.on.net] has joined #go-nuts
23:33 -!- foolusion [43fcbebc@gateway/web/freenode/ip.67.252.190.188] has joined
#go-nuts
23:34 -!- iant [~iant@67.218.107.170] has joined #go-nuts
23:34 -!- mode/#go-nuts [+v iant] by ChanServ
23:37 -!- ExtraSpice [XtraSpice@88.118.35.153] has quit [Remote host closed the
connection]
23:38 -!- tvw [~tv@e176006168.adsl.alicedsl.de] has quit [Ping timeout: 246
seconds]
23:40 -!- PortatoreSanoDiI [~Marvin@dynamic-adsl-94-36-161-78.clienti.tiscali.it]
has quit [Read error: Connection reset by peer]
23:44 < foolusion> I'm working on project euler problem 1 using channels and
my program is deadlocking is there a way to stop a receiver from blocking?  here's
the code I'm using http://pastebin.com/LGJRcx9Z
23:47 -!- TheSeeker [~n@99-153-250-110.lightspeed.irvnca.sbcglobal.net] has quit
[]
23:51 < exch> it's deadlocking because sum() writes to results but nothing
reading from it.  the last Printf() will never be reached.  Either call sum() as a
goroutine, or make results a buffered channel
23:52 < foolusion> In the final printf it calls <-result
23:52 < exch> yea, but it's never reached
23:52 < exch> the write to results in sum() is a blocking write
23:53 < foolusion> oh, will i have to worry about closing channels?
23:53 < foolusion> or goroutines
23:53 < exch> results := make(chan int, 1) <- that makes results a
buffered channel, You can write one value without blocking this way
23:53 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
23:54 < exch> or do 'go sum(mults, result)'
23:54 < exch> that way the blocking will happen in a separate thread and the
main thread will continue to the last Printf() call
23:55 -!- itrekkie [~itrekkie@ip72-200-105-157.tc.ph.cox.net] has joined #go-nuts
23:56 < krutcha> I read it differently but might be drunk
23:56 < foolusion> it must be deadlocking before that
23:56 < krutcha> isn't sum ranging over a channel that's never closed
23:56 < krutcha> so never returning a result?
23:56 < foolusion> before sending to result
23:56 < foolusion> yeah
23:57 < krutcha> so multiples could close the mult channel when it's done
23:58 < krutcha> causing the range to terminate
23:58 < foolusion> how do i close channels?
23:58 < exch> close(c)
23:58 < krutcha> close(mult)
23:59 -!- pharris [~Adium@rhgw.opentext.com] has quit [Quit: Leaving.]
23:59 < foolusion> nice it worked
--- Log closed Wed Apr 13 00:00:43 2011