--- Log opened Sat May 29 00:00:00 2010 00:00 -!- zcram [~zcram@133.193.159.217.dyn.estpak.ee] has quit [Quit: Leaving] 00:05 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Quit: hcatlin] 00:11 -!- bmizerany [~bmizerany@14.sub-75-253-140.myvzw.com] has quit [Remote host closed the connection] 00:13 -!- rhelmer [~rhelmer@adsl-69-107-89-5.dsl.pltn13.pacbell.net] has joined #go-nuts 00:27 -!- marsu [~marsu@166.48.202-77.rev.gaoland.net] has quit [Quit: Leaving] 00:31 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 00:33 < Eko> Why does the testing documentation show the var()s from regexp? 00:33 < Eko> !gopkg testing 00:33 < GoBIR> Eko: Package testing - http://golang.org/pkg/testing 00:34 -!- Xera` [~brit@87-194-208-246.bethere.co.uk] has quit [Read error: Connection reset by peer] 00:34 < Eko> does testing actually duplicate the regexp functionality? 00:34 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined #go-nuts 00:38 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit [Ping timeout: 240 seconds] 00:42 -!- iant [~iant@67.218.106.23] has quit [Ping timeout: 245 seconds] 00:43 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 258 seconds] 00:43 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 00:48 -!- MacCoaster [~MacCoaste@amrutlar.com] has quit [Remote host closed the connection] 00:49 -!- iant [~iant@67.218.106.23] has joined #go-nuts 00:49 -!- mode/#go-nuts [+v iant] by ChanServ 00:53 -!- iant [~iant@67.218.106.23] has quit [Ping timeout: 245 seconds] 00:56 -!- rhelmer [~rhelmer@adsl-69-107-89-5.dsl.pltn13.pacbell.net] has quit [Quit: rhelmer] 01:12 -!- smw [~smw@pool-96-232-88-231.nycmny.fios.verizon.net] has joined #go-nuts 01:15 -!- ly- [~ly-@unaffiliated/ly-] has joined #go-nuts 01:17 -!- crashR [~crasher@codextreme.pck.nerim.net] has joined #go-nuts 01:29 -!- crashR [~crasher@codextreme.pck.nerim.net] has quit [Quit: (◣_◢) BigBrowser is watching ⓎⓄⓊ] 01:31 -!- path[l] [UPP@120.138.102.34] has joined #go-nuts 01:33 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 01:34 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 01:36 -!- path[l] [UPP@120.138.102.34] has quit [Quit: path[l]] 01:44 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 01:45 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 01:45 -!- BrowserUk [~irc1_20_B@92.15.74.184] has quit [Quit: BrowserUk] 01:46 -!- Boney [~paul@210-84-20-164.dyn.iinet.net.au] has joined #go-nuts 02:16 -!- werdan7 [~w7@freenode/staff/wikimedia.werdan7] has quit [Ping timeout: 615 seconds] 02:18 -!- Gracenotes [~person@wikipedia/Gracenotes] has quit [Remote host closed the connection] 02:20 -!- werdan7 [~w7@freenode/staff/wikimedia.werdan7] has joined #go-nuts 02:22 -!- Gracenotes [~person@wikipedia/Gracenotes] has joined #go-nuts 02:48 < Eko> If I have a package that I wrote that I think might be a good addition to the core packages, what would the protocol for submitting something like that be? 02:49 -!- Boney [~paul@210-84-20-164.dyn.iinet.net.au] has quit [Ping timeout: 245 seconds] 02:49 < kmeyer> create a change set and send it for review 02:49 < kmeyer> the process is described somewhere on the site... 02:49 < kmeyer> http://golang.org/doc/contribute.html 02:51 < Eko> kmeyer: thanks! 02:51 < kmeyer> np :) 02:56 -!- Boney [~paul@203-217-94-212.dyn.iinet.net.au] has joined #go-nuts 02:58 -!- Eridius [~kevin@unaffiliated/eridius] has quit [Ping timeout: 258 seconds] 03:02 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 260 seconds] 03:08 -!- Boney_ [~paul@210-84-28-224.dyn.iinet.net.au] has joined #go-nuts 03:10 -!- Boney [~paul@203-217-94-212.dyn.iinet.net.au] has quit [Ping timeout: 240 seconds] 03:14 -!- crashR [~crasher@codextreme.pck.nerim.net] has joined #go-nuts 03:18 -!- Boney_ [~paul@210-84-28-224.dyn.iinet.net.au] has quit [Ping timeout: 260 seconds] 03:20 -!- Boney [~paul@124-168-11-141.dyn.iinet.net.au] has joined #go-nuts 03:20 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined #go-nuts 03:26 -!- Rugxulo [~rugxulo@adsl-065-013-115-246.sip.mob.bellsouth.net] has joined #go-nuts 03:32 -!- ly- [~ly-@unaffiliated/ly-] has quit [Quit: ly-] 03:32 -!- ktg1 [~idr@port-92-206-162-80.dynamic.qsc.de] has joined #go-nuts 03:32 -!- ktg1 [~idr@port-92-206-162-80.dynamic.qsc.de] has quit [Remote host closed the connection] 03:35 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has joined #go-nuts 03:42 -!- Boney [~paul@124-168-11-141.dyn.iinet.net.au] has quit [Ping timeout: 276 seconds] 03:43 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has quit [Remote host closed the connection] 03:52 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 03:52 -!- Boney [~paul@124-168-80-205.dyn.iinet.net.au] has joined #go-nuts 03:53 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 03:56 -!- Rugxulo [~rugxulo@adsl-065-013-115-246.sip.mob.bellsouth.net] has left #go-nuts [] 03:58 -!- KirkMcDonald [~Kirk@pysoy/developer/KirkMcDonald] has quit [Quit: Back later.] 04:13 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has joined #go-nuts 04:15 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has quit [Remote host closed the connection] 04:17 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has joined #go-nuts 04:26 -!- slashus2 [~slashus2@74-137-24-74.dhcp.insightbb.com] has joined #go-nuts 04:31 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 276 seconds] 04:31 -!- KirkMcDonald [~Kirk@pysoy/developer/KirkMcDonald] has joined #go-nuts 04:33 -!- noam_ [~noam@77.127.205.252] has joined #go-nuts 04:36 -!- noam__ [~noam@77.127.205.252] has quit [Ping timeout: 252 seconds] 04:44 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 04:58 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts 04:58 -!- mode/#go-nuts [+v iant] by ChanServ 05:01 -!- scm [justme@d070090.adsl.hansenet.de] has quit [Ping timeout: 258 seconds] 05:02 -!- MizardX [~MizardX@unaffiliated/mizardx] has quit [Ping timeout: 260 seconds] 05:03 -!- scm [justme@d070205.adsl.hansenet.de] has joined #go-nuts 05:09 -!- eikenberry [~jae@mail.zhar.net] has quit [Quit: End of line.] 05:12 -!- slashus2 [~slashus2@74-137-24-74.dhcp.insightbb.com] has quit [Quit: slashus2] 05:38 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit: This computer has gone to sleep] 05:44 < plexdev> http://is.gd/ctYYW by [Rob Pike] in go/src/pkg/netchan/ -- netchan: improve closing and shutdown. there's still more to do. 05:53 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has quit [Remote host closed the connection] 06:08 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 06:12 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 06:13 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 06:22 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has joined #go-nuts 06:24 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts 06:24 -!- gnuvince_ [~vince@70.35.162.12] has quit [Ping timeout: 276 seconds] 06:24 -!- gnuvince [~vince@64.235.207.54] has quit [Ping timeout: 260 seconds] 06:40 -!- nighty^ [~nighty@x122091.ppp.asahi-net.or.jp] has quit [Remote host closed the connection] 06:42 -!- nighty^ [~nighty@x122091.ppp.asahi-net.or.jp] has joined #go-nuts 06:45 -!- zcram [~zcram@133.193.159.217.dyn.estpak.ee] has joined #go-nuts 06:48 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 06:48 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 06:50 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts 06:56 -!- illya77 [~illya77@133-173-178-94.pool.ukrtel.net] has joined #go-nuts 07:02 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller, Faster, Easier. http://miranda-im.org] 07:21 -!- gnuvince [~vince@64.235.207.54] has joined #go-nuts 07:29 -!- gnuvince_ [~vince@70.35.162.216] has joined #go-nuts 07:37 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has joined #go-nuts 07:40 -!- ako [~nya@g226148232.adsl.alicedsl.de] has joined #go-nuts 07:41 -!- aho [~nya@g226210188.adsl.alicedsl.de] has quit [Ping timeout: 272 seconds] 07:47 -!- awidegreen [~quassel@62.176.237.78] has joined #go-nuts 07:56 -!- photron [~photron@port-92-201-93-56.dynamic.qsc.de] has joined #go-nuts 08:02 -!- babusri [~babu@122.171.15.242] has joined #go-nuts 08:07 -!- artao [~artao@pool-96-230-227-28.mdsnwi.dsl-w.verizon.net] has joined #go-nuts 08:08 -!- artao [~artao@pool-96-230-227-28.mdsnwi.dsl-w.verizon.net] has left #go-nuts [] 08:08 -!- TR2N [email@89.180.145.98] has left #go-nuts [] 08:11 -!- babusri [~babu@122.171.15.242] has quit [Remote host closed the connection] 08:23 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 08:24 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 08:47 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined #go-nuts 08:50 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has quit [Ping timeout: 260 seconds] 08:51 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has joined #go-nuts 08:55 -!- noam_ [~noam@77.127.205.252] has quit [Read error: Connection reset by peer] 08:55 -!- noam_ [~noam@77.127.205.252] has joined #go-nuts 09:06 -!- illya77 [~illya77@133-173-178-94.pool.ukrtel.net] has quit [Read error: Connection reset by peer] 09:10 -!- marsu [~marsu@93.10.90.180] has joined #go-nuts 09:11 -!- ikaros [~ikaros@f051143203.adsl.alicedsl.de] has joined #go-nuts 09:20 -!- noam_ [~noam@77.127.205.252] has quit [Read error: Connection reset by peer] 09:20 -!- noam_ [~noam@77.127.205.252] has joined #go-nuts 09:35 -!- Project_2501 [~Marvin@82.84.80.236] has joined #go-nuts 09:42 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de] has joined #go-nuts 09:56 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 09:56 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 10:11 -!- BrowserUk [~irc1_20_B@92.15.74.184] has quit [Quit: BrowserUk] 10:18 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 10:19 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 10:20 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 10:23 -!- Gracenotes [~person@wikipedia/Gracenotes] has quit [Ping timeout: 252 seconds] 10:33 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has quit [Ping timeout: 240 seconds] 10:37 -!- Gracenotes [~person@wikipedia/Gracenotes] has joined #go-nuts 10:40 -!- tav [~tav@78.149.228.252] has quit [Ping timeout: 245 seconds] 10:42 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts 10:47 -!- ikaros_ [~ikaros@f050246134.adsl.alicedsl.de] has joined #go-nuts 10:49 -!- ikaros [~ikaros@f051143203.adsl.alicedsl.de] has quit [Ping timeout: 252 seconds] 11:03 -!- tav [~tav@2001:0:53aa:64c:0:368d:a3e4:5635] has joined #go-nuts 11:05 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts 11:13 -!- ikaros_ [~ikaros@f050246134.adsl.alicedsl.de] has quit [Ping timeout: 258 seconds] 11:28 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has joined #go-nuts 11:37 -!- ikaros [~ikaros@f050251166.adsl.alicedsl.de] has joined #go-nuts 11:37 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has quit [Read error: Connection reset by peer] 11:57 -!- ameno [~ameno@pl053.nas982.p-okinawa.nttpc.ne.jp] has joined #go-nuts 11:57 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 11:58 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 11:58 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 11:59 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 12:00 -!- ameno [~ameno@pl053.nas982.p-okinawa.nttpc.ne.jp] has quit [Client Quit] 12:00 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 12:01 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 12:13 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer] 12:14 -!- dju [dju@fsf/member/dju] has joined #go-nuts 12:17 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 12:18 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 12:24 -!- ktg1 [~idr@e179148143.adsl.alicedsl.de] has quit [Remote host closed the connection] 12:24 -!- BrowserUk [~irc1_20_B@92.15.74.184] has quit [Quit: BrowserUk] 12:27 -!- Yoda-BZH [yoda@unaffiliated/yoda-bzh] has quit [Ping timeout: 264 seconds] 12:27 -!- deso [~deso@x0561a.wh30.tu-dresden.de] has joined #go-nuts 12:30 -!- Yoda-BZH [yoda@ksenia.yoda-bzh.net] has joined #go-nuts 12:30 -!- Yoda-BZH [yoda@ksenia.yoda-bzh.net] has quit [Changing host] 12:30 -!- Yoda-BZH [yoda@unaffiliated/yoda-bzh] has joined #go-nuts 12:34 -!- ampleyfly [~ampleyfly@h-148-139.A163.priv.bahnhof.se] has joined #go-nuts 12:34 -!- General1337 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has joined #go-nuts 12:36 -!- crashR [~crasher@codextreme.pck.nerim.net] has quit [Ping timeout: 260 seconds] 12:37 -!- Keltia_ [roberto@aran.keltia.net] has joined #go-nuts 12:37 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 12:37 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts 12:38 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 12:38 -!- General13372 [~support@71-84-50-230.dhcp.mtpk.ca.charter.com] has quit [Ping timeout: 265 seconds] 12:38 -!- Keltia [roberto@aran.keltia.net] has quit [Read error: Connection reset by peer] 12:40 -!- dju [dju@fsf/member/dju] has quit [Ping timeout: 265 seconds] 12:41 -!- kanru [~kanru@61-30-10-70.static.tfn.net.tw] has quit [Ping timeout: 260 seconds] 12:44 -!- dju_ [dju@fsf/member/dju] has quit [Read error: Connection reset by peer] 12:45 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts 12:58 -!- cco3 [~conley@modemcable227.50-70-69.static.videotron.ca] has joined #go-nuts 13:02 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 13:03 -!- Xera^ [~brit@87-194-208-246.bethere.co.uk] has joined #go-nuts 13:04 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 13:14 -!- ly- [~ly-@unaffiliated/ly-] has joined #go-nuts 13:20 -!- noam_ [~noam@77.127.205.252] has quit [Read error: Connection reset by peer] 13:20 -!- noam_ [~noam@77.127.205.252] has joined #go-nuts 13:30 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 240 seconds] 13:30 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 13:32 -!- crashR [~crasher@codextreme.pck.nerim.net] has joined #go-nuts 13:33 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has quit [Quit: hcatlin] 13:40 -!- aho [~nya@g226148232.adsl.alicedsl.de] has quit [Quit: EXEC_over.METHOD_SUBLIMATION] 13:52 < jnj> I'm playing with the Go-OpenGL package. Any ideas how to convert a *uint8 result from glGetString to a string? 13:52 -!- ikaros [~ikaros@f050251166.adsl.alicedsl.de] has quit [Quit: Leave the magic to Houdini] 13:53 < jnj> (it's an array of chars, zero-terminated, ie. classic string) 13:59 -!- slashus2 [~slashus2@74-137-24-74.dhcp.insightbb.com] has joined #go-nuts 14:03 -!- Agon-laptop [~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has joined #go-nuts 14:08 -!- kel_ [~kel@cpc2-leat2-0-0-cust98.hers.cable.ntl.com] has joined #go-nuts 14:13 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 264 seconds] 14:14 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 14:14 -!- ender2070 [~ender2070@bas5-hamilton14-1279279469.dsl.bell.ca] has joined #go-nuts 14:14 < jessta> jnj: have you tried string(thearray) 14:15 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de] has quit [Quit: Shyde] 14:20 < jnj> jessta: yeah, doesn't work. I ended up changing the Go-OpenGL getString to return a string. 14:23 -!- MizardX [~MizardX@unaffiliated/mizardx] has joined #go-nuts 14:31 < jessta> jnj: makes sense 14:31 < jessta> I think string() only works on a slice 14:34 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has quit [Ping timeout: 258 seconds] 14:34 < jnj> jessta: Yeah, think you're right. 14:37 -!- cco3 [~conley@modemcable227.50-70-69.static.videotron.ca] has quit [Ping timeout: 248 seconds] 14:42 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts 14:52 -!- drry [~drry@unaffiliated/drry] has quit [Quit: Tiarra 0.1+svn-37682M: SIGTERM received; exit] 14:59 -!- awidegreen [~quassel@62.176.237.78] has quit [Quit: No Ping reply in 180 seconds.] 14:59 -!- awidegreen [~quassel@62.176.237.78] has joined #go-nuts 15:06 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined #go-nuts 15:12 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Excess Flood] 15:13 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 15:14 -!- drry [~drry@unaffiliated/drry] has joined #go-nuts 15:48 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 265 seconds] 16:02 < Eko> jnj: not sure what it does in cases like yours, but I have used the bytes package (specifically NewBuffer and .String()) in similar cases. I don't think they were zero-terminated though. 16:02 < Eko> !gopkg bytes 16:02 < GoBIR> Eko: Package bytes - http://golang.org/pkg/bytes 16:05 -!- rv2733 [~rv2733@c-98-242-168-49.hsd1.fl.comcast.net] has joined #go-nuts 16:06 -!- ktg1 [~idr@g225098130.adsl.alicedsl.de] has joined #go-nuts 16:12 -!- illya77 [~illya77@133-173-178-94.pool.ukrtel.net] has joined #go-nuts 16:16 -!- Agon-laptop [~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote host closed the connection] 16:22 -!- ktg1 [~idr@g225098130.adsl.alicedsl.de] has quit [Remote host closed the connection] 16:23 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 16:31 -!- boscop_ [~boscop@f055116056.adsl.alicedsl.de] has joined #go-nuts 16:32 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Ping timeout: 252 seconds] 16:32 -!- boscop [~boscop@f055066045.adsl.alicedsl.de] has quit [Ping timeout: 258 seconds] 16:33 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 16:42 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 16:42 -!- BrowserUk [~irc1_20_B@92.15.74.184] has left #go-nuts [] 16:47 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 16:48 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 16:49 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 16:55 -!- BrowserUk [~irc1_20_B@92.15.74.184] has quit [Ping timeout: 240 seconds] 17:00 -!- ikaros [~ikaros@f050251166.adsl.alicedsl.de] has joined #go-nuts 17:01 -!- tazjin [~tazjin@ip-88-153-92-110.unitymediagroup.de] has joined #go-nuts 17:02 -!- tazjin [~tazjin@ip-88-153-92-110.unitymediagroup.de] has quit [Remote host closed the connection] 17:11 -!- BrowserUk [~irc1_20_B@92.15.74.184] has joined #go-nuts 17:16 -!- Agon [~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has joined #go-nuts 17:33 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 17:33 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 17:34 -!- idr [~idr@g225098130.adsl.alicedsl.de] has joined #go-nuts 17:37 -!- ikaros [~ikaros@f050251166.adsl.alicedsl.de] has quit [Quit: Leave the magic to Houdini] 17:40 -!- noam_ [~noam@77.127.205.252] has quit [Ping timeout: 240 seconds] 17:40 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 17:42 -!- noam_ [~noam@77.127.205.252] has joined #go-nuts 17:42 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has joined #go-nuts 17:43 -!- vsayer [~vivek@c-24-130-25-47.hsd1.ca.comcast.net] has quit [Read error: Connection reset by peer] 17:55 -!- HNSZ [~HNSZ@s55918cef.adsl.wanadoo.nl] has joined #go-nuts 17:55 -!- HNSZ [~HNSZ@s55918cef.adsl.wanadoo.nl] has left #go-nuts [] 17:59 -!- Kashia [~Kashia@p4FEB3E80.dip.t-dialin.net] has joined #go-nuts 18:00 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller, Faster, Easier. http://miranda-im.org] 18:13 -!- illya77 [~illya77@133-173-178-94.pool.ukrtel.net] has quit [Read error: Connection reset by peer] 18:14 -!- Drahgkar [~Drahgkar@66.93.162.10] has joined #go-nuts 18:28 -!- Agon [~marcel@HSI-KBW-095-208-003-128.hsi5.kabel-badenwuerttemberg.de] has quit [Remote host closed the connection] 18:33 -!- idr [~idr@g225098130.adsl.alicedsl.de] has quit [Remote host closed the connection] 18:49 -!- pmyshkin [~a@unaffiliated/pmyshkin] has joined #go-nuts 18:55 < jnj> I'm trying to locate a problem with regards to OpenGL usage.. Is it possible to get some unique id for the current goroutine? 18:55 < jnj> (or the underlying thread) 18:57 < Eko> jnj: you can get what essentially amounts to a stack trace with runtime.Callers or runtime.Caller 18:58 < jnj> Eko: Thank you, I'll check that out. 18:59 < Eko> jnj: however, the "current goroutine" is the innermost function that you've started with go, so I'm not sure if that is really what you're looking for, as it should be discernable by reading the code, yes? 18:59 < Eko> actually, I guess if you're calling a function from multiple goroutines it might not be. 19:01 < pmyshkin> what's the best way to read a file full of space separated floats and output an array of floats? 19:02 < pmyshkin> right now the only way I can see is bufio.ReadBytes -> []byte -> string -> Atof -> []float 19:02 < Kashia> maybe fmt.Scan ? 19:03 < jnj> Eko: I agree my concern is: OpenGL calls needs to be issued from the same thread (for most implementations). My program crashes when I do: initOpenGL(); doOpenGLStuff(); 19:04 < jnj> If I move all of doOpenGLStuff() into initOpenGL it does not 19:04 < jnj> My only guess right now is that the two functions somehow are called in different threads.. if that is even possible. 19:05 < Eko> pmyshkin: you could also go with vector.Vector.Push and fmt.Scan() and then use a make([]float, floatVec.Len()) and a for loop 19:05 < Eko> jnj: chances are your entire program is in the same OS thread unless you changed GOMAXPROCS 19:06 -!- BrowserUk [~irc1_20_B@92.15.74.184] has quit [Quit: BrowserUk] 19:06 < Eko> !goprog multi CPU 19:06 < GoBIR> Eko: Q. Why no multi CPU - http://golang.org/doc/go_programming_faq.html#Why_no_multi_CPU 19:06 < jnj> Eko: Yeah, I changed that to 1 quite a while ago. The reason I'm thinking about threads is that the program does not crash with runtime.LockOSThread 19:07 < jnj> Eko: and seperate calls to init- and do-OpenGL stuff 19:07 < Eko> hmm. 19:07 < Eko> jnj: I would recommend making an OpenGLServer that does LockOSThread and then sits in a loop waiting for RPCs on a channel 19:08 -!- ikaros [~ikaros@f051182014.adsl.alicedsl.de] has joined #go-nuts 19:08 < jnj> Eko: I agree, i'm just curious, to say the least, about what's happening. Is it possible the scheduler changes current-thread at some point, but otherwise continues the program as normal. If that makes sense (my english is not that good) 19:08 < Eko> so you can then do whatever you will from the rest of the program in whatever threads or goroutines 19:10 < Eko> I haven't used the opengl library enough to be able to postulate what might be happening 19:10 -!- ikaros_ [~ikaros@f051182014.adsl.alicedsl.de] has joined #go-nuts 19:13 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts 19:17 -!- rv2733 [~rv2733@c-98-242-168-49.hsd1.fl.comcast.net] has quit [Quit: Leaving] 19:19 < pmyshkin> I guess Fscan would work better, thanks guys 19:23 < pmyshkin> Fscanln is still a little awkward as I'd have to know the number of fields per line ahead of time 19:24 < pmyshkin> so I have to create a byte buffer for each line and then Fscan over that 19:31 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:d577:f2c3:5782:ae2c] has joined #go-nuts 19:35 < pmyshkin> is this idiomatic? 19:35 < pmyshkin> for n, err := fmt.Fscan(linebuf, &f); n != 0; n, err = fmt.Fscan(linebuf, &f) 19:36 < pmyshkin> it seems less elegant than the C idiom of performing the assignment in a while condition 19:36 < pmyshkin> while (n = fmt.Fscan(linebuf, &f)) 19:39 < jnj> for n,err:=fmt.Fscan(linebuf, &f);n!=0 {..} 19:40 -!- unhygienix [~unhygieni@host86-179-203-179.range86-179.btcentralplus.com] has joined #go-nuts 19:40 < pmyshkin> jnj, but won't I have to include n,err = fmt.Fscan(linebuf, &f) in the body of the loop then? 19:42 < jnj> Actually, my example is not even valid .. 19:43 < jnj> My bad 19:44 -!- qfr [~kafir@unaffiliated/yw] has joined #go-nuts 19:48 < jnj> pmyshkin: i guess you could do for n:=0; n!=0; n,err=fmt.Fscan but it's not that much prettier 19:49 < jnj> eh, n:=1 19:49 < jnj> or whatever, !=0. 19:49 < pmyshkin> but then f won't have the correct value in the first iteration 19:49 < jnj> pmyshkin: ah, sorry I thought the body was empty.. 19:50 < pmyshkin> the essential problem here is that there's no way to unify the initialization and increment statements 19:50 < jnj> pmyshkin: for { if n,err:=fmt.Fscan;n==0 { break } ... } ? 19:50 < pmyshkin> jnj, my bad, I just didn't feel like typing the body 19:50 < pmyshkin> ah, that'll work 19:50 < pmyshkin> thanks 19:50 < jnj> pmyshkin: which is a "hack" of course, but it's what I do 19:50 < jnj> pmyshkin: it's not as nice as the C version 19:51 < pmyshkin> doesn't look too bad 19:51 < Eko> jnj: you could do for n,str := strings.Split(filecontents, " ", 0) { flt := strconv.Atof(str); … } 19:52 < pmyshkin> is there supposed to be a range in there? 19:52 < Eko> though you would probably want the Split before that so you can floatSlice := make([]float, len(pieces)) 19:52 < Eko> yeah, lol 19:53 < Eko> I'm so used to ruby et al that the compiler continually reminds me to put "range" ;D 19:53 < pmyshkin> luckily range is also used in python 19:54 < pmyshkin> but I constantly make mistakes between := and = 19:54 < Eko> heh. 19:54 < Eko> am I missing an easy case insensitive string comparison somewhere? 19:57 < pmyshkin> what's the easiest way to convert from []byte to a string? 19:58 < Namegduf> string(foo) 19:58 < Namegduf> A cast will do it. 19:59 < pmyshkin> thanks Namegduf 19:59 < Namegduf> No problem. 20:00 -!- boscop_ [~boscop@f055116056.adsl.alicedsl.de] has left #go-nuts [] 20:00 -!- boscop [~boscop@f055116056.adsl.alicedsl.de] has joined #go-nuts 20:01 < pmyshkin> Namegduf, so the cast will work regardless of whether foo is a slice or an actual array? 20:02 < Namegduf> I believe it works on a slice, not sure about array. 20:03 < Eko> I was having trouble yesterday converting from a uint8[] to a string even though the function said that it returned a byte[]. It was quite annoying. I had to use bytes.NewBuffer([]byte).String() 20:07 < pmyshkin> Namegduf, it apparently doesn't work for an array 20:08 < pmyshkin> this doesn't make any sense 20:09 < Namegduf> pmyshkin: You can always slice the array. 20:09 < pmyshkin> I know, but I would have thought it would be the other way around 20:09 < Namegduf> Getting an array from a slice requires a copy. 20:10 < Namegduf> Taking a slice is the more generic way. 20:10 < pmyshkin> but it says in the language def "Strings behave like arrays of bytes but are immutable" 20:13 < Eko> pmyshkin: use bytes.NewBuffer([]byte).String if you must 20:13 < Namegduf> He doesn't need to. 20:13 < Namegduf> He can just slice the array. 20:13 < Namegduf> And pass that to string() 20:14 < pmyshkin> I'm just trying to get what the cast is doing 20:14 < Namegduf> pmyshkin: It's doing a copy. 20:14 < Namegduf> pmyshkin: That's the only way to get something immutable from something mutable. 20:14 < Eko> Namegduf: should that work for []uint8 too? 20:15 < Namegduf> Eko: Not sure, I've not tried and don't remember. Might be worth a shot. 20:15 < pmyshkin> Namegduf, oh, I didn't realize casts actually execute code 20:15 < Eko> Namegduf: because I fought with this for like an hour yesterday and couldn't get a cast to work. 20:18 < Namegduf> pmyshkin: They can where they need to; casts in Go always result in a valid thing of the target type. 20:18 < Namegduf> So if a int == int32, converting one with int32() probably does very little, but int64() will do the instructions needed to make a valid int64 20:19 < Namegduf> (Exception: unsafe package) 20:20 < pmyshkin> strangely, there's nothing in the language def about casts 20:20 < Namegduf> They might be called conversions or something 20:20 < pmyshkin> oh, thanks 20:22 < pmyshkin> it still seems a little strange that conversions are so smart 20:22 < Namegduf> They are in C, too, and most high level languages 20:22 < Namegduf> C just kinda mixes smart and stupid 20:23 < Namegduf> A char cast to int will do what is needed, as will a floating point cast to int 20:23 < pmyshkin> I guess I never really understood how they worked 20:23 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has joined #go-nuts 20:25 < Namegduf> I would assume pointer casts would do the same if the pointers had different formats, but have no intelligence as regards what the pointer points at. 20:25 < Namegduf> I don't know. 20:29 < pmyshkin> I just did a simple test and as expected the string conversion is taking time linear to the length of the slice 20:29 < Namegduf> Yeah, unfortunately. 20:30 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit: This computer has gone to sleep] 20:30 < pmyshkin> anyway, thanks for clearing all this up for me Namegduf 20:30 < Namegduf> No problem. 20:33 -!- crashR [~crasher@codextreme.pck.nerim.net] has quit [Quit: (◣_◢) BigBrowser is watching ⓎⓄⓊ] 20:52 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de] has joined #go-nuts 20:55 < pmyshkin> if a function returns an error value, what's the idiomatic way to check that no error occurred? 20:55 < pmyshkin> would it just be len(err.String()) == 0 ? 20:56 < Namegduf> pmyshkin: err == nil 20:56 < Namegduf> Or just if err 20:56 < Namegduf> Well, !err 20:57 < pmyshkin> oh, so it's always going to be a pointer, that makes sense 20:57 < Namegduf> It's an interface. 20:57 < Namegduf> Interfaces are nullable. 20:57 < Namegduf> (Because they're basically pointers with benefits) 20:57 < pmyshkin> haha 20:57 < pmyshkin> thanks 20:58 -!- unhygienix [~unhygieni@host86-179-203-179.range86-179.btcentralplus.com] has quit [Quit: unhygienix] 21:02 < Eko> pmyshkin: I usually do something like if val, err := funcWithErrorReturn; err != nil {} where val has been predeclared (so that err doesn't float around in my namespace) 21:03 < Soultaker> Eko: that doesn't actually work, I think? 21:03 < Eko> in the default makefile, is there a target that formats all of the source files 21:03 < Eko> Soultaker: sure it does. 21:03 < Soultaker> not if val is declared outside the scope I mean. 21:04 < Soultaker> it's one of the little 'problems' that I haven't seen a good solution for yet 21:04 < Eko> hmm. Now I must check. I hope that hasn't introduced any bugs >_> 21:05 < pmyshkin> Eko, also, wouldn't val not be in any scope except the if ? 21:05 < Soultaker> I think your code introduces 'val' as a variable local the scope of the if-statement. that works if you also have an else-block, but that introduces a lot of nesting which isn't always nice. 21:06 < Eko> yep, you're right. 21:06 < Eko> luckily, it looks like most of the time I change away from that anyway. 21:08 < Eko> in the same scope when it's already been declared you can still do val, err := if err hasn't been declared 21:08 < Eko> which is what I was thinking. 21:08 * Eko is going to go grep his code for that now, lol 21:09 -!- zcram [~zcram@133.193.159.217.dyn.estpak.ee] has quit [Quit: Leaving] 21:14 -!- bleakgadfly [~cato@2001:470:26:9f:223:9eff:fe00:1018] has quit [Read error: Operation timed out] 21:15 < Soultaker> you can certainly do it. Go allows variables to be shadowed, which is actually nice for the if err := .. idiom 21:15 < Soultaker> I'm not 100% sold on the idea that this is an adequate substitute for exceptions though. 21:17 < Namegduf> It isn't a substitute for exceptions, it's a substitute for error returns, which exceptions are often abused to replace. :P 21:18 < Namegduf> panic() is the handler for true exceptional conditions. 21:18 < Soultaker> that comes across as a bit of a hack to me 21:18 -!- Knutsi [~knut@cm-84.215.55.99.getinternet.no] has joined #go-nuts 21:19 -!- mxweas [~max@c-98-225-102-170.hsd1.az.comcast.net] has joined #go-nuts 21:20 < Soultaker> I understand the use of panic() for unrecoverable operations, but it's pretty ugly to use it for conditions that normal code should be able to handle 21:20 < Namegduf> "conditions that normal code should be able to handle" are pretty much the definition of "not exceptional conditions" 21:21 < Soultaker> yes, ok, so in that case go requires you to manually check all error conditions, which detracts from normal program flow immensely. 21:22 < Soultaker> for example, if I want to read a bunch of parameters, I'd want to do something like: 21:22 < Soultaker> a := ReadInt(); b := ReadFloat(); c := ReadString() 21:22 < Soultaker> however, there's no error checking here. 21:22 < Soultaker> in Java, I could write something like: 21:22 -!- aho [~nya@g226148232.adsl.alicedsl.de] has joined #go-nuts 21:23 < Soultaker> try { a := ReadInt(); b := ReadFloat(); c := ReadString() } catch (SomeException e) { /* handle error */ } 21:23 < Soultaker> which at least separates normal code flow from error handling and only forces me to handle errors at one place. 21:23 < Soultaker> in C++ the std::iostream collects the first error and let's subsequent operations fail, which is also really nice: 21:23 < Soultaker> if (!std::cin >> a >> b >> c) { /* error handling here */ } 21:24 < Namegduf> Your weirdass ReadInt() stuff could do similar if you like. 21:24 < Soultaker> it seems that in Go the only way to do this is to (1) predeclare all variables because I cannot use undeclared and declared variables in one multiple assignment statement 21:24 < Namegduf> Also fun in Java is when you're doing that with IO functions, and you need to close the FD in your catch 21:25 < Namegduf> You can't? 21:25 -!- rhelmer [~rhelmer@adsl-69-107-89-5.dsl.pltn13.pacbell.net] has joined #go-nuts 21:25 < Soultaker> (2) check for errors for every read even if I'm only interested in whether the whole group succeeded or not (which is 99% of I/O scenarios in my experience) 21:25 < Soultaker> so you end up with something nasty like: 21:25 < Soultaker> var a int 21:25 < Soultaker> var b float 21:25 < Soultaker> var c string 21:25 < Soultaker> var e io.Error 21:25 < Soultaker> if a,e = ReadInt; e != nil { /* handle error */ } 21:25 < Soultaker> if b,e = ReadInt; e != nil { /* handle error AGAIN */ } 21:25 < Namegduf> Er 21:25 < Soultaker> if c,e = ReadInt; e != nil { /* handle error YET AGAIN */ } 21:25 < Namegduf> No. 21:26 < Soultaker> erm, s/ReadInt/ReadInt()/ etc. 21:26 < Namegduf> That's code you'd get *if you were interested in individual errors* 21:26 < Soultaker> so how are you supposed to collect them then? 21:26 < Namegduf> If you just wanted the whole group, you could quite happily just check e at the end. 21:26 < Namegduf> You're also supposed to use defer() to handle cleanup 21:26 < Soultaker> no I can't, because ReadInt() might fail, but ReadString() might succeed. 21:26 < Namegduf> So if you have a lot of stuff in your error handling 21:27 < Namegduf> Soultaker: That totally depends on your I/O functions. 21:27 < Soultaker> well true, which is why the Scanner code I wrote to use with the GCJ was modeled after C++'s iostreams, which I think are most convenient. 21:27 < Namegduf> Soultaker: In the case of the C++ ones you're comparing it to, that's false. If you're making the Go ones behave different/less weirdly just because, then it'ss not a fair comparison. 21:28 < Namegduf> The Go way is to use defers to not need massive amount of crap in error handling. 21:28 < Namegduf> So you're not duplicating anything significant. 21:28 < Namegduf> This also makes other early return conditions clean. 21:28 < Soultaker> how does defer() solve this problem? 21:28 < Soultaker> now you're just handwaving ;) 21:28 < Namegduf> You clearly don't know that, *given that you just asked what I meant*. 21:29 < Soultaker> and I certainly can use C++ idioms when writing Go code (and I have indeed done so), the point I was making that the recommended way to do error handling in Go is not ideal. 21:29 < Namegduf> defer() removes the need for much cleanup code beyond the return itself 21:29 < Namegduf> Because you defer cleanup of something at the point it becomes necessary 21:29 < Soultaker> Namegduf: could you be a little less belittling? 21:30 < Soultaker> I know what defer does. I just don't see how it solves the problem I posed. 21:30 < Namegduf> The problem you were whining about was duplication of error handling. 21:30 < Namegduf> The bulk of error handling is cleanup. 21:31 < Namegduf> Go does not require cleanup to be duplicated, and thus makes the problem massively less bad than your example with significant parts commented out would suggest. 21:31 < Namegduf> (It also gets cases where you'd just be using try... finally... for "free") 21:31 < Soultaker> not just the duplicatio nof error handling. the fact that I have to manually sequence operations with if/then/else operations if I have a sequence of operations, each of which could fail, and I want to terminate the whole sequence when one does. 21:32 < Soultaker> I've given code snippets in three languages to support my point; please show me how it's done rather than handwaving about defer() ;) 21:32 < pmyshkin> Soultaker, concerning the issue with :=, I just found this in the language def: "Unlike regular variable declarations, a short variable declaration may redeclare variables provided they were originally declared in the same block with the same type, and at least one of the non-blank variables is new." 21:32 < Namegduf> Ah, I thought that was the case, yes. 21:33 < Namegduf> Soultaker: You are correct in that it introduces boilerplate to bubble up the errors. 21:33 < Soultaker> well, that was mainly my point ;) 21:33 < Soultaker> and that's tedious sometimes. 21:34 < Namegduf> "sometimes", yes, but not in the majority of code. 21:34 < Soultaker> although it's appropriate when you want detailed info about when and where the first failure occured 21:34 < Namegduf> And making it explicit provides guarantees that errors are handled properly; checked exceptions do this too. 21:34 < Soultaker> it depends a bit on the type of code you write. in my opinion C++'s iostreams are very well-designed in that the designers recognized tha in the majory of cases you do not need this amount of detail 21:34 < Soultaker> making the common case easiest 21:35 < Soultaker> while still allowing you to get precise information when required. 21:35 < Soultaker> I feel that Go forces you to do a lot of work every time. 21:35 < Soultaker> I don't believe checked exceptions force anything in a strict sense. 21:35 < Namegduf> I'm not using a "strict" sense. 21:36 < Soultaker> I've see too much Java code of the form try { /* code */ } except { } 21:36 < Namegduf> I've written quite a bit, usually while trying to close FDs in an except block 21:36 < Soultaker> and in Go, I write a, _ := ReadInt() and be done with it too 21:36 < Namegduf> I'm looking at it in a maintainability sense. 21:36 < Namegduf> They force you to either address errors or very very explicitly ignore them. 21:37 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts 21:37 < Namegduf> You'll never have your program die due to an unhandled exception with checked exceptions or Go. 21:37 < jnj> While I'm definitely getting what you are saying Soultaker, I've never been a fan of try { f1();f2();f3(); } If fN fails and I only aim to continue if all succeds, why do fN+1,fN+2, etc. It just seems.. wrong I guess. If you care about which one fails (say you want to retry N and continue with N+1,N+2), try won't work anyway 21:38 < Soultaker> pmyshkin: Re the := thing: I just verified and in that case you ARE creating a new variable which shadows the previous declaration. 21:38 -!- dju_ [dju@fsf/member/dju] has quit [Max SendQ exceeded] 21:38 < Namegduf> Soultaker: It's valid for your "I have to predeclare a, b, and c" thing 21:38 < pmyshkin> Soultaker, really? that seems to go against the language def 21:38 < Soultaker> I think my build is a week or two old though 21:38 < pmyshkin> "Redeclaration does not introduce a new variable; it just assigns a new value to the original." 21:38 -!- dju_ [dju@fsf/member/dju] has joined #go-nuts 21:39 < Soultaker> maybe I did something wrong 21:39 < jnj> var a int; a,err:=Bla() updates value of a. if a,err:=Bla() creates new 'a' with if-scope. 21:39 < Soultaker> http://pastie.org/983690 21:39 < Soultaker> ah, I'm trying with an if-statement 21:39 < pmyshkin> so it's the if that is creating the new scope, not the redeclaration 21:39 < Soultaker> because in the scenario 'b' is an error which I want to handle. 21:40 -!- plavcik [~plavcik@bilbo.navratil.cz] has quit [Ping timeout: 240 seconds] 21:40 < Soultaker> (the code snippet I pasted prints '1' because the assignment to a in the if-statement is to a separate variable) 21:40 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:d577:f2c3:5782:ae2c] has quit [Quit: Leaving.] 21:40 < Soultaker> that makes sense I guess, but still doesn't solve the problem of assigning a value to an existant variable while still checking the resultant error 21:41 < Soultaker> I also think this makes some things a lot uglier. Did I understand correctly that this is valid go: 21:41 < Soultaker> var a, b int 21:41 < Soultaker> a, err := f() 21:41 < Soultaker> if err != nil { /* someting */ } 21:41 < Soultaker> a, err = g() 21:42 < Soultaker> if err != nil { /* something */ } 21:42 < Soultaker> err, I meant b the second time 21:42 < Soultaker> with the point being that the first time I must use := because err has not been declared, but the second time I must NOT use := because it would not introduce new variables? 21:43 < pmyshkin> I think it'll be fine if you use := the second time 21:43 < Eko> pmyshkin: nope 21:43 < jnj> using := with no new variables causes an error 21:43 < Eko> but if you do b, err := g() it'll be happy 21:43 < Soultaker> no, that's not allowed, because I cannot declare a new variable with the same in the same scope. 21:43 < pmyshkin> oh, I see 21:44 < Soultaker> hmm, I guess that works in many cases.. 21:44 < jnj> Soultaker: so yes, := first, = afterwards. Your example is how I currently do error-checking.. 21:44 < Eko> Soultaker: you can only NOT use := if you are "redeclaring" ALL variables in the same scope 21:45 < Soultaker> yes, that's clear now. 21:45 < Eko> and, as a user/sysadmin, I really appreciate it when I am told exactly what input failed if I'm feeding something into an application 21:45 < Soultaker> I wonder if it would have been better if Go did not allow shadowing at all 21:45 < jnj> Soultaker: While it's more code, it generally means more specific error messages. 21:45 < Eko> so maybe the answer to your issue is that Go is forcing you to be nicer to your users. 21:45 < Soultaker> because then I could have written if a, err := foo() { /*..*/ } and Go could unambigously assign to an existant variable a. 21:46 < Eko> you also need the ; err != nil 21:46 < Soultaker> yes, that was just a typo. 21:46 < Eko> but the {}s wrap onto two or more new lines anyway 21:46 < Soultaker> or rather I forgot it =) 21:46 < Eko> so you're already looking at at least 3 lines of code 21:46 < Eko> what's a 4th to keep a in scope? 21:47 < Eko> you should probably have a comment or something too describing what's going on for readability 21:47 < Soultaker> well, the way I see it there are two ways to fix the problem: 21:47 < Soultaker> 1. predeclare err even though it's only used in the if-body (so you have to declare it in a higher scope than you use it) 21:48 < Soultaker> (so then you can use a,err = foo()) 21:48 < Soultaker> or put the code that uses a in an else-block 21:48 < Soultaker> which is less nice i.m.o. because it can create quite deep nesting 21:48 < Eko> what problem? 21:48 < Soultaker> instead of having the 'main code' on a single nesting level, you get a staircase of fragments 21:49 < Soultaker> the 'problem' of wanting to refer to 'a' outside the if-statement 21:49 < Eko> see what I said above. 21:50 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller, Faster, Easier. http://miranda-im.org] 21:50 -!- rhelmer [~rhelmer@adsl-69-107-89-5.dsl.pltn13.pacbell.net] has quit [Ping timeout: 276 seconds] 21:50 < Eko> If you need a elsewhere, you just move the if by itself. 21:50 < Soultaker> maybe I misunderstood. what did you propose exactly? 21:50 < Eko> which is a single line of extra code to prevent your staircase issue 21:50 < Soultaker> ah ok, but then aren't you still introducing err in a different scope then you actually need it? 21:51 < Soultaker> the whole point of allowing a declaration in an if statement seemed to me to avoid having to declare variables in a greater scope than where you need them. 21:51 < Eko> if you're worried about lots of error conditions, and it seems you are, you might as well just reuse err anyway. That way, any errors that are discovered can be looked at by your defer closure. 21:51 -!- plavcik [~plavcik@bilbo.navratil.cz] has joined #go-nuts 21:51 < Soultaker> (and by the way, I do what you suggest in several places, because it seems one of the cleanest ways around the problem, but I felt it could be nicer) 21:52 < Eko> they are there so that when they are convenient, you can use them, and so that when they are inconvenient, you can NOT use them. 21:52 < pmyshkin> as a metacomment, this whole conversation kind of shows that := is not as easily grasped as it may appear to a new user 21:52 < Soultaker> (so it's not a bad suggestion, but it's not completely satisfactory imho.) 21:53 < Eko> pmyshkin: yeah, it actually confused me a lot when I first read the description of them, and I've forgotten more programming languages than most people I work with have ever learned. 21:54 < Eko> however, I don't know if reworking := so that it only declares a variable if it is not in scope at all would be too drastic a change or not. 21:54 < Eko> it could concievably break a LOT of people's code 21:54 < kmeyer> I'd be a fan of pascal-stype ":=" and "=" or C-style "=" and "==", but the ":="/"=" distinction kind of bugs me 21:54 < kmeyer> Eko: that's totally ok at this point 21:55 < Soultaker> I could imagine an explicit syntax to introduce new variables 21:55 < Soultaker> e.g. for a, var err := foo(); err != nil { } 21:55 < Eko> Soultaker: that's what var is ;) 21:55 < Eko> ah. 21:55 < Soultaker> though that's more verbose. 21:55 < Soultaker> I know, but currently var doesn't allow multiple assignment, does it? 21:55 < pmyshkin> not too bad 21:56 < Soultaker> I'm not sure how that would work out if you want to declare a and not b, or want to declare both. 21:56 < Soultaker> s/for/if/ btw 21:56 -!- carllerche [~carllerch@208.87.61.203] has joined #go-nuts 21:56 < Eko> var a, var b, var c := func() actually looks fairly nice 21:56 < Soultaker> if var a, var b := foo() { } // is a lot more verbose than now. 21:57 < pmyshkin> but it makes what is being declared very explicit, which is good 21:57 < Eko> but if we're doing that, then what's to stop us from removing := entirely? 21:57 < Eko> you would always be able to say var x = f() 21:58 < Eko> eh, actually, I like := for telling the compiler to "infer types for me" 21:58 < Eko> which I suppose would be the distinction. 21:58 < pmyshkin> var does that too 21:59 < Eko> orly? 21:59 < pmyshkin> doesn't it? 21:59 < pmyshkin> like you said, var x = f() 21:59 < Eko> I thought you had to say "var x type" 21:59 < pmyshkin> that infers the type of x from the return type of f() 21:59 < Eko> oh, maybe it does… because that's legit in a var ( x = f() ) 21:59 < Eko> so it's probably fine not in the distribution. 22:00 < pmyshkin> for err variables you probably don't care whether they're declared or redeclared, so maybe it's annoying to keep track? 22:00 < Eko> maybe we should introduce a ? variable alongside _ that is the generic error variable? 22:00 < pmyshkin> Eko, your suggestion of allowing multi-assignments with no new declarations also works 22:01 < pmyshkin> but it seems like they have a good reason for having that condition 22:01 < Soultaker> on an unrelated note, is there a way to assign multiple results in a normal var declaration? 22:01 < Soultaker> I can do: var i int = f() 22:02 < Eko> Soultaker: I occasionally will do a,b,c := true, false, false 22:02 < Soultaker> but I can't do: var i,j int = g() right? 22:03 < Eko> I'm not sure if there is a var syntax for doing something similar with function returns. 22:03 < Soultaker> although I guess in that case the := syntax makes more sense generally. 22:03 < Eko> indeed. 22:03 < Eko> and if you want an interface variable instead of one of the return types, you predeclare it 22:03 < Eko> there may well be a var syntax for that though. 22:04 < Eko> !gospec variable declarations 22:05 < Eko> sigh. The spec say you can only have one type in a variable declaration statement. 22:06 < Eko> oh. 22:06 < Eko> !golang variable declarations 22:06 < GoBIR> Eko: Spec Section Variable declarations - http://golang.org/doc/go_spec.html#Variable_declarations 22:06 < GoBIR> Eko: Spec Section Short variable declarations - http://golang.org/doc/go_spec.html#Short_variable_declarations 22:07 < pmyshkin> aside: is there a generic MakeError("msg") function? 22:07 < Soultaker> I think there is something like os.NewError()? 22:07 < Eko> os.NewError(errortext string) os.Error 22:07 < pmyshkin> thanks 22:07 < Eko> np. 22:08 < pmyshkin> a related question, why doesn't string type have a String() method? 22:08 < Eko> string is a basic, non-interface type 22:08 < Eko> and as such has no methods associated with it 22:08 < pmyshkin> right 22:09 < pmyshkin> I was hoping I could just return a literal string as an error 22:09 < Eko> ah. well, the convention is to use os.Error *shrug* 22:09 < Eko> or a boolean. 22:13 -!- ShadowIce [pyoro@unaffiliated/shadowice-x841044] has quit [Quit: Verlassend] 22:18 -!- slashus2 [~slashus2@74-137-24-74.dhcp.insightbb.com] has quit [Quit: slashus2] 22:20 -!- tvw [~tv@e176003176.adsl.alicedsl.de] has quit [Remote host closed the connection] 22:22 -!- boscop [~boscop@f055116056.adsl.alicedsl.de] has quit [Read error: Connection reset by peer] 22:22 -!- boscop [~boscop@f055116056.adsl.alicedsl.de] has joined #go-nuts 22:23 < uriel> so many dumb/misinformed comments: http://www.reddit.com/r/programming/comments/c93iy/ 22:24 < uriel> so many dumb/misinformed comments: http://www.reddit.com/r/programming/comments/c93iy/ 22:24 -!- Drahgkar [~Drahgkar@66.93.162.10] has left #go-nuts [] 22:24 < uriel> *sigh* 22:26 -!- Knutsi [~knut@cm-84.215.55.99.getinternet.no] has quit [Ping timeout: 276 seconds] 22:27 < kmeyer> you expected better from reddit? hah :P 22:31 -!- gnuvince_ [~vince@70.35.162.216] has quit [Read error: Connection reset by peer] 22:32 -!- gnuvince_ [~vince@70.35.162.216] has joined #go-nuts 22:35 < pmyshkin> what's the difference between a cast and a type assertion? 22:35 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de] has quit [Remote host closed the connection] 22:37 -!- deso [~deso@x0561a.wh30.tu-dresden.de] has quit [Read error: Connection reset by peer] 22:38 -!- Kashia [~Kashia@p4FEB3E80.dip.t-dialin.net] has quit [Quit: This computer has gone to sleep] 22:44 -!- ender2070 [~ender2070@bas5-hamilton14-1279279469.dsl.bell.ca] has quit [Ping timeout: 245 seconds] 22:59 -!- hstimer [~hstimer@70.90.170.37] has joined #go-nuts 22:59 < hstimer> has anyone built go to something not ~/bin ? 23:00 < hstimer> I set GOBIN but it is still being built to ~/bin 23:00 < kmeyer> yeah, I've definitely installed it other places 23:01 < hstimer> kmeyer: you set $GOBIN where you wanted it build right? 23:02 < hstimer> kmeyer: what OS are you on? 23:02 < kmeyer> linux 23:06 -!- carllerche [~carllerch@208.87.61.203] has quit [Quit: carllerche] 23:06 -!- awidegreen [~quassel@62.176.237.78] has quit [Read error: Connection reset by peer] 23:07 -!- Eko1 [~eko@adsl-76-251-230-31.dsl.ipltin.sbcglobal.net] has joined #go-nuts 23:09 -!- Eko [~eko@adsl-76-251-230-31.dsl.ipltin.sbcglobal.net] has quit [Ping timeout: 276 seconds] 23:11 < hstimer> ah... when you sudo it doen't pickup your environment variables.... duh 23:13 < hstimer> I needed a sudo -E 23:13 -!- unhygienix [~unhygieni@host86-179-203-179.range86-179.btcentralplus.com] has joined #go-nuts 23:25 -!- Xera` [~brit@87-194-208-246.bethere.co.uk] has joined #go-nuts 23:27 -!- Xera^ [~brit@87-194-208-246.bethere.co.uk] has quit [Ping timeout: 240 seconds] 23:30 -!- kimelto [~kimelto@sd-13453.dedibox.fr] has left #go-nuts [] 23:32 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts 23:32 -!- rlab [~Miranda@91.200.158.34] has quit [Client Quit] 23:45 -!- ender2070 [~ender2070@bas5-hamilton14-1279279469.dsl.bell.ca] has joined #go-nuts 23:49 -!- kanru [~kanru@61-228-155-113.dynamic.hinet.net] has joined #go-nuts 23:51 -!- Rescue_2501 [~Marvin@82.84.80.236] has quit [Read error: Connection reset by peer] 23:54 < Eko> pmyshkin: a cast actually changes the type of a value and will error out in the compiler if it is improper. A type assertion makes an interface value into an interface or type value if it is already that type or a compatible type. If it isn't, it is a runtime panic (unless you use the special two-value context, which gives you a boolean indicating success or failure) 23:54 < Eko> !gospec type assertion 23:54 < Eko> !golang type assertion 23:55 < GoBIR> Eko: Spec Section Type assertions - http://golang.org/doc/go_spec.html#Type_assertions --- Log closed Sun May 30 00:00:00 2010