--- Log opened Sun Dec 19 00:00:01 2010
00:12 -!- devrim [~Adium@cpe-72-225-239-227.nyc.res.rr.com] has quit [Quit:
00:12 -!- devrim [~Adium@cpe-72-225-239-227.nyc.res.rr.com] has joined #go-nuts
00:24 -!- xash [~xash@d063060.adsl.hansenet.de] has quit [Ping timeout: 240
00:31 -!- tvw [~tv@e176000192.adsl.alicedsl.de] has quit [Ping timeout: 240
00:34 -!- photron_ [~photron@port-92-201-87-128.dynamic.qsc.de] has quit [Ping
timeout: 276 seconds]
00:46 -!- virtualsue [~chatzilla@93-97-62-8.zone5.bethere.co.uk] has quit [Remote
host closed the connection]
00:57 -!- wrtp [~rog@] has quit [Quit: wrtp]
01:05 -!- flavius [~flav@unaffiliated/flavious] has quit [Quit: WeeChat - a better
irssi, get it now: http://www.weechat.org/]
01:21 -!- morphbot [~morphbot@p57B5352A.dip.t-dialin.net] has joined #go-nuts
01:21 -!- morphbot [~morphbot@p57B5352A.dip.t-dialin.net] has left #go-nuts []
01:23 -!- kanru [~kanru@61-228-154-25.dynamic.hinet.net] has joined #go-nuts
01:30 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
01:58 -!- ExtraSpice [~XtraSpice@] has quit [Ping timeout: 276
02:02 -!- shvntr [~shvntr@] has joined #go-nuts
02:26 -!- inv_arp [~junya@] has quit [Ping timeout: 272 seconds]
03:01 -!- boscop [~boscop@f055253088.adsl.alicedsl.de] has quit [Ping timeout: 240
03:02 -!- boscop [~boscop@f055001126.adsl.alicedsl.de] has joined #go-nuts
03:07 -!- vermi [959f7527@gateway/web/freenode/ip.] has joined
03:10 < vermi> for this snippet of code http://pastebin.com/cBfY6cMH, i am
getting output that looks like 99%o(MISSING)f when there's a % followed by a
space.  How can I keep that from happening?
03:13 < cbeck> I believe %% will do it
03:15 < vermi> cbeck: I don't have control over the input though
03:21 < cbeck> Are you using printf or print?
03:22 < cbeck> when that happens
03:25 < vermi> printf
03:42 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has joined
03:44 -!- l00t [~i-i3id3r_@] has joined #go-nuts
03:47 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has quit [Quit:
03:51 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has joined
03:54 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has quit [Client
04:15 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has joined
04:25 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has quit [Quit:
04:29 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has joined
04:31 -!- l00t [~i-i3id3r_@] has quit [Quit: Leaving]
04:32 -!- vermi [959f7527@gateway/web/freenode/ip.] has quit [Quit:
Page closed]
04:32 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
04:35 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
04:35 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has quit [Quit: LeNsTR]
04:36 -!- LeNsTR [~lenstr@unaffiliated/lenstr] has joined #go-nuts
04:43 -!- raylu [raylu@c-24-131-193-106.hsd1.pa.comcast.net] has joined #go-nuts
04:43 < raylu> i'm trying to compile 61b2c52b0d22+
release/release.2010-12-15.1 on a x86 debian testing/squeeez system
04:44 < raylu> i've compiled other releases before, but i currently have the
04:44 < raylu> .dynsym: fflush: not defined
05:22 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has quit [Read
error: Connection reset by peer]
05:22 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has joined
05:33 -!- CodeWar [~pou@c-24-23-206-137.hsd1.ca.comcast.net] has joined #go-nuts
05:43 -!- CodeWar [~pou@c-24-23-206-137.hsd1.ca.comcast.net] has quit []
05:57 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has quit [Quit:
06:03 -!- pingveno [~pingveno@c-98-246-133-8.hsd1.or.comcast.net] has quit [Ping
timeout: 240 seconds]
06:05 -!- pingveno [~pingveno@c-98-246-133-8.hsd1.or.comcast.net] has joined
06:16 -!- sav [~lsd@jagat.xored.org] has joined #go-nuts
06:27 -!- DarthShrine [~angus@58-6-93-222.dyn.iinet.net.au] has joined #go-nuts
06:27 -!- DarthShrine [~angus@58-6-93-222.dyn.iinet.net.au] has quit [Changing
06:27 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has joined
06:28 -!- KiiK [~chatzilla@] has joined #go-nuts
06:30 -!- KiiK [~chatzilla@] has quit [Remote host closed the
06:31 -!- KiiK [~chatzilla@] has joined #go-nuts
06:36 -!- KiiK [~chatzilla@] has quit [Remote host closed the
06:42 -!- iant [~iant@nat/google/x-dscksszojxmheaev] has quit [Ping timeout: 276
06:57 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has quit [Quit:
06:59 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has joined #go-nuts
06:59 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
06:59 -!- mode/#go-nuts [+v iant] by ChanServ
07:08 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
07:11 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has joined
08:02 -!- jeff2 [~sername@c-98-210-113-215.hsd1.ca.comcast.net] has quit [Quit:
08:23 < taruti> iant: in gccgo Makefile.am there are lots of if
LIBGO_IS_LINUX foo_files = foo_linux.go endif ..., is there any reason why it is
not using foo_files = foo_$(GOOS).go etc ?
08:23 < taruti> iant: would make porting cause much less clutter in
08:28 -!- adu [~ajr@pool-173-66-11-168.washdc.fios.verizon.net] has quit [Quit:
08:34 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
08:42 -!- pingveno [~pingveno@c-98-246-133-8.hsd1.or.comcast.net] has quit [Ping
timeout: 260 seconds]
08:44 -!- pingveno [~pingveno@c-98-246-133-8.hsd1.or.comcast.net] has joined
08:45 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
08:51 -!- tvw [~tv@e176007038.adsl.alicedsl.de] has joined #go-nuts
08:58 -!- idr [~idr@e179154096.adsl.alicedsl.de] has joined #go-nuts
09:14 -!- plediii [~plediii@nat-168-7-237-163.rice.edu] has joined #go-nuts
09:17 -!- plediii [~plediii@nat-168-7-237-163.rice.edu] has quit [Client Quit]
09:21 -!- xash [~xash@d073182.adsl.hansenet.de] has joined #go-nuts
09:21 -!- idr [~idr@e179154096.adsl.alicedsl.de] has quit [Remote host closed the
09:23 -!- tensai_cirno [~cirno@] has joined #go-nuts
09:24 < tensai_cirno> hello, anyone using gccgo?
09:24 < tensai_cirno> how i should compile package with multiple files?
09:24 < tensai_cirno> for example building mylib package, with mylib1.go and
mylib2.go sources
09:24 < tensai_cirno> gccgo -c mylib1.go and gccgo -c mylib2.go
09:25 -!- idr [~idr@e179154096.adsl.alicedsl.de] has joined #go-nuts
09:25 < tensai_cirno> and other module, which using mylib should import
mylib1 and mylib2
09:25 < tensai_cirno> but i want to import just mylib
09:26 < taruti> tensai_cirno: gccgo a.go b.go ...  ?
09:27 -!- rlab [~Miranda@] has joined #go-nuts
09:32 -!- idr [~idr@e179154096.adsl.alicedsl.de] has quit [Remote host closed the
09:34 < tensai_cirno> taruti, iit just produces a.o and b.o
09:36 < tensai_cirno> taruti, http://hpaste.org/42419/gccgo_link
09:37 -!- idr [~idr@e179154096.adsl.alicedsl.de] has joined #go-nuts
09:38 < tensai_cirno> any ideas?
09:40 < tensai_cirno> uh oh
09:40 < tensai_cirno> my bad
09:40 < tensai_cirno> taruti, yep, that works
09:40 < tensai_cirno> thanks :-)
09:41 -!- rlab_ [~Miranda@] has joined #go-nuts
09:43 -!- rlab [~Miranda@] has quit [Ping timeout: 276 seconds]
09:43 -!- idr [~idr@e179154096.adsl.alicedsl.de] has quit [Remote host closed the
09:45 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
09:49 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
09:49 -!- tensai_cirno [~cirno@] has quit [Ping timeout: 265 seconds]
09:49 -!- photron_ [~photron@port-92-201-178-243.dynamic.qsc.de] has joined
10:02 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has joined #go-nuts
10:02 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has quit [Client Quit]
10:03 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has joined #go-nuts
10:03 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has quit [Client Quit]
10:03 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has joined #go-nuts
10:04 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
10:07 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has quit [Quit:
10:08 < reuben> I'm hoping someone can help me through a rough time here.
I'm new to Go. I'm writing a little game to teach myself the language.  Part of
this includes a resource manager.  My question (possibly) relates to checking for
the existence of a key in a map
10:08 < reuben> http://pastebin.com/kqmL5g5F
10:09 < reuben> the map in question is gfxResources
10:12 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
10:12 < reuben> If anyone happens to be in the spirit, a more useful paste
of the code/issue is at: http://pastebin.com/7Wt0T1Ls
10:16 < TheSeeker> first dimb question: have you tried using a full path to
the image instead of a relative one?
10:18 < TheSeeker> dumb question too ...  perhaps I should sleep.
10:19 < reuben> I'll try it now
10:21 -!- femtooo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
10:24 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Ping
timeout: 240 seconds]
10:24 < reuben> Hmm, separate question: is it possible to discard some
values of a multiple-return value function when used in a const expression or a
function call
10:24 < reuben> for example:
10:24 < reuben> const WORKING_DIR = os.Getwd()
10:25 < reuben> that won't compile, since os.Getwd() returns (string, Error)
10:27 < reuben> (oh, apparently cant use the return of a function call in a
const anyway, but the question is still relevant for function calls)
10:28 < TheSeeker> you already are using the method to do so ...  _
10:30 < reuben> But how would I go about using that in the argument list of
a function call?
10:30 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has joined
10:31 < reuben> Like so, but somehow compiling and working :) -- var GFX_DIR
string = path.Join(os.Getwd(), "gfx")
10:36 -!- ExtraSpice [~XtraSpice@] has joined #go-nuts
10:48 -!- xash [~xash@d073182.adsl.hansenet.de] has quit [Read error: Operation
timed out]
10:52 -!- sauerbraten [~sauerbrat@p508CCB1D.dip.t-dialin.net] has joined #go-nuts
10:53 -!- photron_ [~photron@port-92-201-178-243.dynamic.qsc.de] has quit [Ping
timeout: 265 seconds]
11:00 -!- ouah [~godisdead@unaffiliated/ouah] has joined #go-nuts
11:03 < TheSeeker> path.Join doesn't seem to work for me...  probably
because I'm on windows :P
11:04 < reuben> It will be great once we get first class Windows and Android
support :)
11:04 < reuben> That they'
11:04 < reuben> re included in mainstream (android being arm) is great
11:05 < TheSeeker> no, I'm just doing it wrong.
11:05 < TheSeeker> FOO = path.Join(FOO, BAR) not just path.Join(FOO, BAR)
11:05 < reuben> path.Join("gfx",resource)
11:05 < reuben> yeah
11:08 < TheSeeker> foo, _ := os.Getwd()
11:08 < TheSeeker> var GFX_DIR string = path.Join(tmp, "gfx")
11:09 < reuben> problem is, I can't do that outside of a function body,
since short declarations aren't allowed
11:09 < reuben> :=, that is
11:09 < reuben> maybe i'm mistaken as to the reason
11:11 -!- oldumy [~oldumy@] has joined #go-nuts
11:12 < oldumy> hi, is there a full commented doc of cgo?
11:13 < TheSeeker> nope.  closest thing other than the soruce that I know of
is http://golang.org/cmd/cgo/
11:15 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-162-69.clienti.tiscali.it] has
joined #go-nuts
11:19 < TheSeeker> reuben: this works for me.
11:20 -!- oldumy [~oldumy@] has quit [Read error: Connection reset
by peer]
11:20 < reuben> thanks
11:20 < reuben> that works
11:20 -!- oldumy [~oldumy@] has joined #go-nuts
11:20 < reuben> similar to what I have
11:20 -!- skejoe [~skejoe@] has joined #go-nuts
11:21 < reuben> would be cool if it were possible to evaluate os.Getwd() as
part of an argument list, though
11:21 < TheSeeker> I notice there's no "Setwd()" either...
11:22 < oldumy> TheSeeker: That one is too poor.
11:24 -!- oldumy [~oldumy@] has quit [Client Quit]
11:24 -!- femtooo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Ping
timeout: 255 seconds]
11:24 -!- oldumy [~oldumy@] has joined #go-nuts
11:28 -!- oldumy [~oldumy@] has left #go-nuts []
11:33 -!- flavius [~flav@unaffiliated/flavious] has joined #go-nuts
11:34 -!- dju [~dju@fsf/member/dju] has joined #go-nuts
11:34 < flavius> Hi. In the go tutorial, they imply that var s string = "",
var s = "" and s := "" are the same.  However for var i = 0 ...  does not work,
for i := 0 does.So what is actually the difference?
11:35 < flavius> or is it simply not allowed by the compiler?  if so, that's
not consistent with the tutorial
11:36 -!- plediii [~plediii@nat-168-7-237-209.rice.edu] has joined #go-nuts
11:36 < reuben> that's right, the short declaration is allowed in some
places the longer one isn't
11:36 < reuben> And vice versa
11:37 < reuben> for example, := can only be used within the body of a
function, not outside (in the cold, dark outerspace)
11:37 -!- dju [~dju@fsf/member/dju] has quit [Max SendQ exceeded]
11:38 -!- dju [~dju@fsf/member/dju] has joined #go-nuts
11:40 < flavius> I see, so at the ASM level := is allowed where you could
expect a MOV instruction (the .text section).  Is my assumption right?
11:40 -!- plediii [~plediii@nat-168-7-237-209.rice.edu] has quit [Client Quit]
11:41 < reuben> I think it's purely for syntactic reasons (am I wrong?)
11:43 -!- ExtraSpice [~XtraSpice@] has quit [Quit: Leaving]
11:44 < flavius> If so, they've really done everything to make go compile as
fast as possible
11:45 < flavius> From what I've read, it's a one-pass compiler, right?
11:46 < reuben> It may be for parsing simplicity or human readability when
used in scoped variables (for, if initialisers)
11:46 < TheSeeker> yeah, single pass.
11:50 -!- ExtraSpice [~XtraSpice@] has joined #go-nuts
11:53 -!- plediii [~plediii@nat-168-7-237-209.rice.edu] has joined #go-nuts
12:03 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
12:04 < flavius> What are the fmt's format specifiers?
12:04 < reuben> The issue I had with my game crashing, by the way, was that
I was redeclaring & shadowing some variables...  using := instead of =
12:04 < reuben> They're in the doc for fmt
12:05 < reuben> golang.org/pkg/fmt
12:05 < reuben> but
12:05 < reuben> %v fill format most things like fmt.Print[ln]() does
12:05 -!- tvw [~tv@e176007038.adsl.alicedsl.de] has quit [Ping timeout: 240
12:05 < reuben> and %d works for signed and unsigned integer types
12:05 < reuben> since it uses reflection
12:09 < flavius> reuben: thanks
12:11 < flavius> Is there any pastebin which supports go syntax?
12:12 < reuben> I was wondering the same thing 2 hours ago...  I'm guessing
not, since the topic points us to pastebin.com
12:17 -!- DerHorst [~Horst@e176098072.adsl.alicedsl.de] has joined #go-nuts
12:23 < flavius> How can I initialize an array?  a := int[3]{1,2,3} doesn't
12:23 < flavius> "type int is not an expression"
12:24 < reuben> I think it's like so: a := [3]int{1,2,3}
12:25 < reuben> yeah, it is
12:25 < reuben> alternatively, allow the compiler to infer the size:
12:26 < reuben> or use the slice constructor: []int{1,2,3}
12:33 < flavius> One more strange thing: what with GCC would be a warning,
causes 6g not to compile at all, for instance not using a variable "a declared and
not used"
12:33 < flavius> could I force it to ignore that?
12:34 < reuben> It's kinda like GCC with the -Werror flag.  Actually, I wish
it gave more warnings...  like for the issue I just had: it would be nice if the
static analysis of the compiler told me that I was shadowing 2 variables when I
used :=
12:38 -!- femtooo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
12:41 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Ping
timeout: 240 seconds]
12:42 -!- femtooo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Ping
timeout: 240 seconds]
12:42 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
12:43 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
12:43 -!- wrtp [~rog@] has joined #go-nuts
12:46 -!- ouah [~godisdead@unaffiliated/ouah] has quit [Disconnected by services]
12:47 < flavius> Is there a sizeof operator?
12:50 < flavius> oh the unsafe package seems to provide one
12:51 -!- kashia_ [~Kashia@port-92-200-52-15.dynamic.qsc.de] has quit [Quit: This
computer has gone to sleep]
12:52 < fuzzybyte> does anyone know of any go apps for helping localization
(ie.  for translating your app to different languages)?
12:54 < flavius> fuzzybyte: I haven't seen any by chance (although I wasn't
specifically looking for one), but you may want to go through the lists at
12:55 < flavius> I doubt though there is something for working with .po
files or similar
12:56 < fuzzybyte> guess i have to make one meself
12:56 < reuben> You're a pioneer, fuzzybyte
12:56 < flavius> well I guess you'd only have to write the a binding, I
think I've read something yesterday about SWIG and FFI
12:56 < fuzzybyte> yes, i want to work with .po files or similiar.
12:57 < flavius> read through those stuff, you'll certainly find something
useful, if not all by itself, then it will at least help you
12:59 < fuzzybyte> i read about swig earlier.  very nice, it has go support
too now.
13:04 -!- wrtp [~rog@] has quit [Ping timeout: 260 seconds]
13:07 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
13:08 -!- wrtp [~rog@] has joined #go-nuts
13:12 < fuzzybyte> ..wait what?  no, i did not mean translating in that
sense, lol.  I just want to translate my go website's english interface to
finnish.  how did this go to swig..  im too tired to think what i read.
13:16 < fuzzybyte> i was just looking something like the message files (.po
files) in django
13:20 < KBme> well, i'm guessing because you need gettext support for that
13:31 < flavius> fuzzybyte: take a nap :-)
13:31 < reuben> My naughts and crosses game seems to work alright :)
13:41 -!- reuben [~reuben@220-253-8-81.VIC.netspace.net.au] has quit [Ping
timeout: 250 seconds]
13:45 < flavius> Is it fine to create a slice from an array upon calling a
function accepting []int?  Is it comparably as bad as passing an entire array to a
function in C?
13:45 < flavius> a is the array, I call it like sum(a[:])
13:46 < KBme> i think that's what slices are for
13:46 < KBme> you can pass the whole array that way, or a slice of it ;)
13:46 < KBme> and it will be references to the array's elements so it
doesn't take up much space
13:46 < flavius> Hm I'm ...  exactly that was I about to say :-)
13:47 < flavius> so modifying the slice elements' values inside the function
will change the values in the caller's array?
13:48 < flavius> yep, just tested it
13:49 < flavius> ok, so the line you have to draw is heap (because of the
"segmented stack" stuff) usage vs.  self-containment of a function
13:53 -!- saschpe [~quassel@opensuse/member/saschpe] has joined #go-nuts
13:58 -!- ouah [~godisdead@unaffiliated/ouah] has joined #go-nuts
14:01 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
14:10 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-162-69.clienti.tiscali.it] has
quit [Quit: E se abbasso questa leva che succ...]
14:13 -!- _DerHorst_ [~Horst@e176127179.adsl.alicedsl.de] has joined #go-nuts
14:16 -!- DerHorst [~Horst@e176098072.adsl.alicedsl.de] has quit [Ping timeout:
272 seconds]
14:16 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has quit [Quit:
14:18 < flavius> it's obvious to me how you can use slices to modify the
underlying array, but how to modify an "underlying map"?  The tutorial only says:
If you're holding a slice or a map and you modify its contents, other variables
referencing the same underlying data will see the modification.
14:19 < KBme> yes, maps and slices are reference types, so when you pass
them around you will always pass by reference
14:19 < KBme> at least that's how i understood it
14:20 < TheSeeker> so...  use locking where needed to prevent heisenbugs!
14:21 < KBme> hah first time I hear that expression
14:23 -!- terrex [~terrex@] has joined #go-nuts
14:25 < flavius> lol yeah, it's listed on
http://en.wikipedia.org/wiki/Unusual_software_bug among others
14:31 -!- napsy [~luka@] has joined #go-nuts
14:31 -!- Netsplit *.net <-> *.split quits: XenoPhoenix
14:31 -!- rlab_ [~Miranda@] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
14:32 -!- shvntr [~shvntr@] has quit [Ping timeout: 260 seconds]
14:32 -!- rlab [~Miranda@] has joined #go-nuts
14:33 < KBme> lmao on that page, thanks
14:34 -!- TheMue [~TheMue@p5DDF616B.dip.t-dialin.net] has joined #go-nuts
14:35 -!- Netsplit over, joins: XenoPhoenix
14:36 < flavius> why does my map doesn't have reference semantics in this
example http://pastium.org/view/f342d7d701ede4c8727ac59033ce0470 ?
14:39 < KBme> ah, no
14:39 < KBme> a is an int
14:40 < KBme> so it will be copied
14:40 < KBme> you would do &a then
14:40 < KBme> the map itself is always a reference
14:40 < TheMue> m has, but not a.  It's an int.
14:42 < TheMue> m["answer"]++ works
14:43 < flavius> So what is the difference between make() and new()
actually?  In C terms where applicable
14:45 < KBme> make is for builtin types, specifically chan, map and slice
14:45 < flavius> yes, but why?  arrays, ints, etc, are also built in, why do
you use new() for them?
14:45 < TheMue>
14:46 < TheMue> http://golang.org/doc/go_faq.html#new_and_make
14:46 < TheMue> new is just allocation, make is initializing
14:47 < flavius> I see, as in malloc() vs.  calloc()
14:58 < flavius> "In contrast, new([]int) returns a pointer to a newly
allocated, zeroed slice structure, that is, a pointer to a nil slice value." Could
you give me an example when such a slice is useful?
14:58 -!- niemeyer [~niemeyer@201-2-134-72.pltce701.dsl.brasiltelecom.net.br] has
joined #go-nuts
15:05 -!- niemeyer [~niemeyer@201-2-134-72.pltce701.dsl.brasiltelecom.net.br] has
quit [Ping timeout: 240 seconds]
15:06 < KBme> when you initialise a struct you need to create it's members
before assigning to them
15:20 < flavius> KBme: your answer puzzles me even more.  Could you show a
POC of what you mean?
15:21 < KBme> http://golang.org/doc/go_spec.html#Allocation
15:22 < KBme> first code example
15:24 < flavius> yes but my question was about the usefulness of "zeroed
15:24 < flavius> not about structs
15:25 < KBme> new is for structs, as you can see in the documentation
15:25 < KBme> wile make is for reference types, like map, slice and chan
15:26 -!- ouah [~godisdead@unaffiliated/ouah] has left #go-nuts []
15:26 < KBme> new([]string) is not really useful i don't think
15:41 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
15:42 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
15:49 -!- illya77 [~illya77@150-69-133-95.pool.ukrtel.net] has joined #go-nuts
15:57 -!- Guest95927 [~irc@] has quit [Quit: leaving]
15:59 -!- jo___ [~Jo@p4FEB6DCE.dip.t-dialin.net] has joined #go-nuts
16:00 -!- saschpe [~quassel@opensuse/member/saschpe] has quit [Ping timeout: 250
16:00 -!- ios_ [~ios@] has joined #go-nuts
16:02 -!- irc [~irc@] has joined #go-nuts
16:03 -!- ios_ [~ios@] has quit [Client Quit]
16:14 -!- oldumy [~oldumy@] has joined #go-nuts
16:18 -!- tvw [~tv@e176007038.adsl.alicedsl.de] has joined #go-nuts
16:21 < flavius> wow, methods for structures, it feels mostly like function
pointers in C structs, except it's more elegant.  I'm starting to go nut
16:21 < flavius> interesting mix of python and C
16:22 < TheMue> yep
16:25 -!- aiju [~aiju@unaffiliated/aiju] has joined #go-nuts
16:26 < aiju> is there a document on software design with Go?
16:26 < aiju> i always end up with circular dependencies between files
16:27 < flavius> I guess the "calling convention" works almost as in C from
the assembly POV, except what in C++ was this or self in python, is now simply
shifted in the function parameters, right?  So there's no "function decoration" as
it's in C++ to make polimorphism work, that's the only difference regarding this
16:30 < Namegduf> flavius: Yes, although the calling convention for all
functions is incompatible due to segmented stacks.
16:30 < Namegduf> That's a separate tweak, though.
16:30 < Namegduf> Interfaces, OTOH, are basically a pointer to a vtable +
the value or a pointer to it.
16:32 < uriel> interesting, had not seen this before:
16:32 < Namegduf> OIh, me neither.
16:33 < aiju> with Go i basically end up stuffing everything in one file
16:34 < kimelto> you mean no shared lib?
16:34 < Namegduf> Make each package do a fairly significant and well-defined
16:34 < uriel> aiju: you can have multiple files that make up one package
16:34 < Namegduf> They should not attempt to replicate classes.
16:34 < aiju> uriel: oh didn't knew that
16:34 < aiju> Namegduf: i'm writing an emulator, i have a CPU and a PPU
module which need each other
16:34 * uriel wonders if aiju has WTFM
16:34 < uriel> er RTFM
16:34 < Namegduf> aiju: Then they need to go in the same package
16:35 < aiju> i don't know it by heart yet
16:35 < aiju> also i'm badly influenced by a certain other language with a P
and an y :P
16:35 < Namegduf> I would strongly suggest trying to make them *not* need
each other in that way if they're huge, though.
16:35 < uriel> I was thinking 'either aiju is way dumber than I thought, or
he is getting something very basic very wrong'
16:35 < Namegduf> I thought Python could do multifile packages, to?
16:35 < Namegduf> *too?
16:35 < aiju> i have a no clue
16:35 < exch> aiju:
https://github.com/jteeuwen/go-example-multipkg/blob/master/app/Makefile <- 2
files for the same package
16:35 < aiju> -a
16:36 < uriel> aiju: really, if you look at any of the standards packages,
most of them are spread over a few different files
16:36 < uriel> aiju: and this is certainly covered in the basic docs
16:36 < aiju> sorry, i'm completely new to Go
16:36 < flavius> Go is so nice, it's what I always wanted C be.  And I
haven't yet started to dig into the parallelisation stuff, at that point it will
feel like a language for crunching numbers I guess (because of the almost
do-nothing scale-out capabilities)
16:36 < uriel> aiju: blahblahblah, give me another excuse ;P
16:37 < Namegduf> flavius: It isn't quite as easy as that, but yeah.  The
short version is that Go makes parallisation cheaper, but it's still far from
16:37 < Namegduf> You only gain from scaling out when you have significant
enough amounts of work per goroutine.
16:37 < uriel> there is no free lunch
16:37 < aiju> flavius: i currently still miss the ternary operator and
pointer arithmetic
16:37 < aiju> so i'd basically make the whole program one huge package
16:38 < Namegduf> Depends on what you call huge
16:38 < Namegduf> It's a design fault in your program if it's genuinely huge
and you can't split it into parts which aren't interdependent
16:38 < uriel> aiju: huhu?  why?!?!
16:38 < aiju> well, only 1415 lines currently and most of it are lookup
16:38 < uriel> you only keep in one package conceptually related stuff,
which often depends on eachother
16:39 < Namegduf> 1415 is not so bad for a single package over multiple
16:39 < flavius> Namegduf: is it expensive for multicores too?
16:39 < uriel> aiju: so, you barely got any code, why are you even worrying
about packages yet?
16:39 < aiju> because i got the whole concept wrong :P
16:39 < uriel> aiju: did you read Effective Go, etc...?
16:40 < aiju> probably not careful enough
16:40 < Namegduf> Packages are designed to basically be coherent,
conceptually separated units of functionality, with a solid separation of public
vs private.
16:40 -!- oldumy [~oldumy@] has quit [Ping timeout: 260 seconds]
16:40 < exch> It also pays to just read some of the existing packages.  Or
at least glance over them, to pick up a few tricks
16:40 < Namegduf> They're at about the right size and design to use as
program "modules"
16:40 < uriel> exch: yup
16:40 < Namegduf> Or "units"
16:40 < Namegduf> I had a fun thing yesterday.
16:40 < Namegduf> I started bitfiddling and found myself adding semicolons
16:41 < Namegduf> Had to catch myself.
16:41 < Namegduf> (I hadn't needed to do bitfiddling in Go before)
16:41 < aiju> so how do i "glue" the files together?
16:41 < uriel> aiju: !?!?!
16:41 < aiju> include?
16:41 < uriel> wtf do you even mean?
16:42 < Namegduf> No, you give them both to the compilation command.
16:42 < exch> in the makefile: GOFILES = a.ho b.go c.go
16:42 < aiju> oic
16:42 < Namegduf> You don't "glue" them together or "include" them into each
16:42 < uriel> aiju: for fucks sake, stop acting like a newbie, and fucking
read the basic docs and take a look at existing commands
16:42 < exch> s/ho/go/
16:42 * exch gives uriel a lollipop
16:42 * uriel kicks aiju
16:42 < uriel> exch: thanks ;)
16:42 < flavius> aiju: I guess you've never written a larger program in a
system language like C for example?
16:43 < aiju> flavius: depends on what you call "large"
16:43 < flavius> aiju: more than one .c file
16:43 < aiju> yes
16:43 < Namegduf> flavius: Go cheaply puts multiple goroutines across
multiple cores.
16:43 < aiju> i write a header file for each "functional unit" and #include
16:43 < flavius> "yes" meaning "no I haven't"?
16:44 < uriel> aiju: please, read up on how packages work, this stuff is not
rocket science, even I understand it
16:44 < flavius> the principles are the same as in C
16:44 < uriel> flavius: not really
16:44 < flavius> except you don't have headers
16:44 < aiju> it's also like driving a car
16:44 < aiju> except you don't have a car...
16:44 < uriel> precisely the problem with C is that it has no concept of
'package' or other such compilation unit
16:45 < Namegduf> The header file does not have anything to do with actually
linking the multiple source files together
16:45 < Namegduf> In C
16:45 < uriel> aiju: exactly
16:45 < flavius> uriel: I mean the concepts of linking and compiling,
they're just like in C
16:45 < aiju> no
16:45 < aiju> in C i compile each file seperately
16:45 < aiju> and then i link the whole thing together
16:45 < Namegduf> Right
16:45 < Namegduf> This is how Go works
16:45 < aiju> 17:42 < Namegduf> No, you give them both to the
compilation command.
16:46 < flavius> aiju: Well I always do "gcc *.c" and have working .o files
16:46 < aiju> well, i never
16:46 < Namegduf> Right.  That's a trivial difference in the precise
commands used in lieu of header files.
16:47 < Namegduf> I only produce one .6 per package, myself, but I think you
can do it otherwise.
16:47 < uriel> flavius: no they are not like in C, I think you are
misreading aiju's level of confusion
16:47 < Namegduf> (The default makefiles are awful, but work for
single-package projects)
16:47 < uriel> btw, here is a handy new(?) doc:
16:48 < aiju> oh perfectly ty uriel
16:48 < uriel> 16:47 < Namegduf> I only produce one .6 per package,
myself, but I think you can do it otherwise.
16:48 -!- ios_ [~ios@] has joined #go-nuts
16:48 < uriel> Namegduf: really?  I doubt it, and doing so would be pretty
dumb I'd think
16:49 -!- illya77 [~illya77@150-69-133-95.pool.ukrtel.net] has quit [Read error:
Connection reset by peer]
16:49 < Namegduf> Hmm, okay.
16:49 < aiju> they should have brought mk :(
16:49 < uriel> the whole point of packages (or at least part of the whole
point) is that they are a 'compilation unit'
16:49 < aiju> GNU make is an abomination
16:49 < uriel> aiju: stop whinning
16:49 < Namegduf> I've not touched the defualt makefiles in a good while
because I found them useless
16:49 < uriel> aiju: all you need is like five lines of Makefile per
package, so get over it
16:50 < uriel> Namegduf: 'useless'?  what is wrong with them?  they work
just fine
16:50 < Namegduf> uriel: Actually getting a multi-package project working is
much harder than that due to package interdependencies.
16:50 < Namegduf> Which the default Makefiles will not handle.
16:51 < Namegduf> Coupled with intallation into ~/go, you get things
building against wrong or different versions of the same packages and then failing
to work together.
16:51 < uriel> I'm not quite convinced the default makefiles need to know
about package interdependencies, just write a very simple top level makefile or
even shell scripts that runs all the per-package makefiles
16:51 < TheMue> Hmm, for me they work like a charm.  Single projects like
documented and multi-package projects just as a compilation of the needed
16:51 < Namegduf> The problem is rebuilds, uriel.
16:51 < uriel> TheMue: exactly
16:52 < Namegduf> The individual package makefiles need to know they should
rebuild from scratch when a dependent package changed.
16:52 < Namegduf> They don't.
16:52 < uriel> Namegduf: I still don't see the problem, but then, most of my
projects are not multi-package
16:52 < uriel> Namegduf: still it is trivial to have a script that nukes
everything and rebuilds everything, and with Go that is pretty damned
16:53 < taruti> just requiring mk might make sense :)
16:53 < Namegduf> Writing a better Makefile makes sense
16:53 * Namegduf has one Makefile building all his packages, with rules for most
automatically generated
16:55 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Ping
timeout: 240 seconds]
16:55 < Namegduf> uriel: That worked so long as everything was completely
nuked, I think.
16:56 -!- oldumy [~oldumy@] has joined #go-nuts
16:56 < aiju> i love gofmt
16:56 < flavius> On http://golang.org/doc/go_tutorial.html in the function
func (file *File) Write(b []byte) (ret int, err os.Error) {
16:56 < flavius> why do they not use "ret" for the return value?
16:56 < flavius> but they do use "err"
16:57 < aiju> var Bios [256]uint8 = [256]uint8{ <-- how would one clean
this up (global array)?
16:57 -!- Fish- [~Fish@9fans.fr] has joined #go-nuts
16:57 -!- wrtp [~rog@] has quit [Quit: wrtp]
16:58 < uriel> aiju: I fucking told you
16:58 < uriel> see #cat-v
16:58 < aiju> it fucking doesn't work
16:58 < aiju> bios.go:20: non-declaration statement outside function body
16:58 < uriel> oh, at the top level := doesn't work
16:59 < Namegduf> You can't; it's one line, though.  When you have a
significant percentage of your project suffering from such stuttering, *then*
there's a problem.
16:59 < aiju> the "i use lookup tables" problem?
16:59 < uriel> the 'you use too many damned global vars' problem
16:59 < Namegduf> You'd need to have like 1000 lookup tables for the line on
which each lookup table starts to be a significant portion of your code
17:00 < aiju> it's a fucking constant
17:00 < Namegduf> ANd they'd need to be pretty small
17:00 < uriel> aiju: arrays are not constants
17:00 < uriel> and I guess it is a good thing := doesn't work at the top
level, it discourages people from having too many globals
17:00 < aiju> uriel: constant as in "it is never changed"
17:00 < Namegduf> It's weird.  I don't remember why.
17:00 < uriel> aiju: and that is fine, still I don't see the problem
17:01 < aiju> http://phicode.de/git/?p=gb.git;a=summary what i'm working on
17:02 -!- oldumy [~oldumy@] has quit [Ping timeout: 240 seconds]
17:03 < uriel> aiju: looks fine to me, I might put the long global arrays in
their own file or something, but looks fine
17:03 < aiju> i think it depends
17:04 < aiju> i think the Printstate function is really ugly
17:04 < aiju> but i wouldn't know how to clean it up (disasm.go)
17:04 < uriel> obviously, it is a judgement call, and a not very important
one either
17:04 < Namegduf> You could use a switch for that.
17:04 < Namegduf> Hmm, no.
17:05 < aiju> printf("...%c...", ..., (F & FLAGS) ? 'S' ? ' ', ...);
17:05 < aiju> that was the C version
17:05 < aiju> ehm :
17:05 < Namegduf> That would suck pretty badly, too.
17:05 -!- saschpe [~quassel@opensuse/member/saschpe] has joined #go-nuts
17:07 < aiju> i think at some places i forgot about named return values
17:07 < aiju> but it seems like i have to return anyway
17:09 < flavius> On http://golang.org/doc/go_tutorial.html in the function
func (file *File) Write(b []byte) (ret int, err os.Error) {, why do they not use
"ret" for the return value, but they do use "err"?
17:11 -!- towerhe [~towerhe@] has joined #go-nuts
17:14 -!- deso [~deso@x0561a.wh30.tu-dresden.de] has joined #go-nuts
17:16 < uriel> flavius: ?!?
17:16 < exch> they dont have to in this case
17:16 < exch> you are not obligate dto use the named return values by their
name.  Just depends on what is more convenient
17:17 < exch> the return bit could also be written as ' ret = int(r);
17:17 < exch> but that's 2 lines of code as opposed to the current 1 liner
17:19 < flavius> exch: yes but they could have used ret and err on line 65
in the first place, couldn't they?
17:20 < flavius> so 65-69 would have become only 2 lines
17:20 < exch> nope
17:20 < flavius> unless there is something I'm missing
17:20 < exch> the syscall functions return uintprt values, not int and
17:20 < exch> *uintptr
17:20 < exch> the extra code below is to convert the uintptrs to the actual
return types
17:21 < flavius> I see
17:21 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has joined #go-nuts
17:21 < exch> if syscall.Write had the same return values, then they could
have just done 'return syscall.Write(file.fd, b)
17:21 < flavius> yeah
17:23 < flavius> I also see that in go, the "break" is implicit for case
branches.  How to make the execution flow "fall through" the next branch, as I
would do in C by ommitting the break?
17:23 < exch> with the fallthrough keyword
17:23 < flavius> Oh lol
17:24 < flavius> and I used that only as a metaphor
17:24 < exch> hehe
17:25 < flavius> thanks
17:25 < exch> np
17:25 < aiju> does Duff's device work with Go?
17:25 < aiju> ◔ ◡ ◔
17:26 < exch> I sure hope not :p
17:30 < exch> Didn't the xml unmarshal function use struct field tags to map
xml tags to fields at some point?
17:31 < uriel> exch: afaik you can at least do that with json, so I guess
with xml too
17:31 < exch> it's no longer working it seems :<
17:32 < uriel> why do you want to use xml anyway?
17:32 < exch> this rest api i'm working with has no json output.  which
17:32 < uriel> ah, yuck :(
17:32 < uriel> but I still think it should work for xml
17:34 -!- ios_ [~ios@] has quit [Quit: Leaving]
17:34 < exch> nope, definitely not
17:37 < exch> I was inclined to just name the struct fields after the xml
nodes, but tbh it's ugly.  I'm more inclined to just do the parsing manually
17:37 * exch prepares for a long, long night
17:40 < aiju> tnli = 0x9000 + 16 * uint16(int16(int8(tn)))
17:41 < exch> O.o
17:41 < aiju> better idea?
17:41 < exch> what type is 'tn'?
17:42 < aiju> uint8
17:42 < exch> why make it signed first?
17:42 < aiju> tn = 0xFF should yield 0x9000 - 16
17:43 * exch puzzeled
17:43 < exch> If you have to convert 'tn', doesnt uint16(tn) do the trick?
17:43 < aiju> no
17:43 < aiju> that would yield 0x9000 + 16 * 0xFF
17:48 < exch> I think i'm missing some context then.  I don't understand
what you are trying to achieve.  Perhaps someone else is smarter than me :p
17:48 -!- towerhe [~towerhe@] has quit [Ping timeout: 276 seconds]
17:49 < aiju> treat tn as a signed number, multiply it by 16 and add that to
17:55 < aiju> is there something like USED in plan 9 C?
17:56 < uriel> aiju: _
17:56 < aiju> perfectly
17:59 < uriel> really, RTFM man
18:00 < aiju> i know _, but i didn't knew it could be used like that
18:01 -!- irc [~irc@] has joined #go-nuts
18:02 < fuzzybyte> is there way to disable that annoying "X declared and not
used" 'error'?  I don't care if im not using it (yet).
18:02 -!- Guest8331 [~irc@] has quit [Read error: Connection reset by
18:02 -!- Guest62296 [~irc@] has quit [Read error: Connection reset
by peer]
18:05 < TheMue> Just don't declare it
18:05 < TheMue> In case of a multi-value function return use the underscore
18:06 < fuzzybyte> Ugh.
18:06 < exch> fuzzybyte: _ = x;
18:06 < exch> now it's used
18:06 -!- irc_ [~irc@] has joined #go-nuts
18:06 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has joined
18:07 < aiju> how was that Go Spectrum emulator called?
18:08 < exch> go-speccy I believe
18:08 < aiju> ah exactly, thx
18:08 < exch> https://github.com/remogatto/gospeccy
18:10 < aiju> what should i use for graphics output?  exp/draw?
18:16 < exch> it's X11 support is rather limited.  You can use it with the
image/* packages for output to an image file.  Or if you something more serious,
there are opengl and SDL bindings you could use
18:21 -!- pure_x01 [~pure@h-4-84.A155.priv.bahnhof.se] has joined #go-nuts
18:25 < pure_x01> hi, im trying to build gccgo and have tried some times
before but it allways fail with: -I ../.././libgo/../gcc -I ../../gcc/include -O2
-g3 -O0 -MT go-map-len.lo -MD -MP -MF .deps/go-map-len.Tpo -c -o go-map-len.lo
`test -f 'runtime/go-map-len.c' || echo '../.././libgo/'`runtime/go-map-len.c
18:25 < pure_x01> ../.././libgo/runtime/go-go.c: In function
18:25 < pure_x01> ../.././libgo/runtime/go-go.c:354:1: error: bp cannot be
used in asm here
18:26 < aiju> does gccgo have garbage collection yet?  :<
18:27 < fuzzybyte> aiju: it has mark-sweep GC
18:28 < tdnrad> hopefully
18:29 < tdnrad> last I read the gccgo didn't
18:29 -!- dgreensp [~dgreenspa@68-185-89-44.dhcp.snlo.ca.charter.com] has joined
18:30 < aiju> go uses dynamic linking?
18:30 < Namegduf> No
18:30 < jo___> yes, for C libraries ;)
18:30 < Namegduf> C libraries are not part of Go
18:30 < aiju> trying to get 2e9a9b SDL running
18:30 < Namegduf> gccgo has the same GC that the normal Go compilers do.
18:31 < Namegduf> Does gccgo have better goroutines now?
18:31 < Namegduf> That's the part I'm wondering about.
18:31 < Namegduf> (i.e.  not implemented as OS threads)
18:32 < aiju> d /quit
18:32 < taruti> Namegduf: OS threads atm
18:33 < Namegduf> Ah, pity.
18:33 < dgreensp> how do I use Go without any makefiles?  is there a good
example or tutorial that does this?
18:33 < aiju> why would you do that?
18:34 < tdnrad> Namegduf: really?  I thought not too long ago
18:34 < tdnrad> I read otherwise...  hmm
18:35 < kimelto> dgreensp: 6g + 6l ?
18:35 < aiju> are you all using AMD64?  O.o
18:35 < Namegduf> tdnrad: A GC was added fairly recently.
18:35 < Namegduf> Yes.
18:35 < dgreensp> kimelto: how are packages resolved in that case?
18:36 < Namegduf> AMD64 is the platform Go is most tested on, because it's
the architecture used by all proper Linux installations on machines made in the
last five years
18:36 < Namegduf> :P
18:36 < dgreensp> (I'm very new to Go)
18:36 < aiju> dgreensp: still, why would you do that?  what's wrong with
18:36 < aiju> Namegduf: my laptop is made in 2003
18:36 < aiju> ◔ ◡ ◔
18:37 < Namegduf> dgreensp: 6g and 6l know where to find things in your
18:37 < Namegduf> dgreensp: You can add a -I and -L parameter, respectively,
to include another package search path.
18:37 < dgreensp> cool.
18:38 < dgreensp> I've just never liked or needed "make" for any of my toy
C/Java/etc projects, it adds a layer of complexity
18:38 < Namegduf> It basicaly goes like:
18:38 < Namegduf> 6g -o <object file> <list of source files>
18:38 < Namegduf> 6l -o <executable> <object files>
18:38 < Namegduf> Er, object file, I think.
18:39 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
18:39 < Namegduf> For an executable.
18:39 < aiju> dgreensp: i just have a huge directory for such project with a
18:39 < Namegduf> gopack is used to pack packages for inclusion in others.
18:40 < kimelto> gopack is an ar on steroids?
18:40 < Namegduf> No idea.
18:40 < Namegduf> I don't even know how I found out how to use it.
18:41 < Namegduf> All I know is that my Makefile runs "gopack grc package.a
18:41 < Namegduf> And it works.
18:41 < kimelto> It adds a special Go-specific section __.PKGDEF that
collects all the Go type information from the files in the archive; :-)
18:41 < aiju> anybody knows how to compile ⚛sdl?
18:44 < dgreensp> Namegduf: thanks!  so, can I import a package without
"installing" it?  ideally I could just throw a bunch of files in different
packages at 6g like I can in java
18:44 < dgreensp> it seems like the paths in "import" refer to installed
18:44 < Namegduf> I'm not sure I understand what you mean
18:44 < Namegduf> In the second part of the sentence.
18:45 < exch> you can import it without installing, but you need to specify
the path in import, or supply the -I and -L flags to the Go linker/compiler, so
they know where to look for the packages
18:45 < Namegduf> No, files in different packages cannot be compiled
together ever because Go has visibility and namespaces at the package level, not
the file level like Java.
18:45 < exch> like import "../bin/mypkg"
18:45 < Namegduf> (Java is technically at the class level, but classes are
per file)
18:45 < Namegduf> The first half is easier to answer, and is yes.
18:45 < dgreensp> so if I have "foo/bar.go", and a file "baz.go" that
imports "foo/bar", I have to compile and "install" foo/bar first?
18:46 < Namegduf> You have to build.
18:46 < Namegduf> Install, depends on definition of install.
18:46 < Namegduf> import looks by file path, relative to given search
directories using -I
18:46 < dgreensp> I see, the .o files just have to be findable
18:46 < Namegduf> No, the .a file has to be.
18:46 < dgreensp> oh...  what's .a?
18:46 < pure_x01> is there anyone who can point me to some docs on how to
build gccgo
18:47 < pure_x01> from the main gcc trunk
18:47 < Namegduf> .a is the extension of a GO package.
18:47 < Namegduf> *Go
18:47 < Namegduf> It's what gopack outputs.
18:47 < dgreensp> so I have to "pack" foo/bar before I can import it?
18:47 < Namegduf> Yes.
18:47 < Namegduf> And then you need to put the produced .a somewhere
specified by -I
18:48 < dgreensp> ok, I'm understanding why makefiles are used better now --
because building a project requires many invocations of the compiler
18:48 < Namegduf> Yes, like most other compiled languages.
18:48 < Namegduf> You need to build and link, and you need to build and link
different packages separately.
18:49 < dgreensp> In my, or Go's, defense, the how-to says: "It would be
nice to have Go-specific tools that inspect the source files to determine what to
build and in what order, but for now, Go uses GNU make."
18:50 < Namegduf> Yes; such a tool could determine what invocations were
18:50 < Namegduf> It wouldn't avoid doing them, it'd just do it for you.
18:50 < exch> Dependency resolution is very easy to do
18:50 < Namegduf> If history is any indicator it'd also be basically useless
unless you're the person who designed it
18:51 < Namegduf> But c'est la vie.
18:51 -!- watr_ [~watr@] has joined #go-nuts
18:53 < dgreensp> heh, in my book a tool that "does something for me" is
quite an improvement over copy-pasting a bunch of makefile boilerplate myself
18:53 < Namegduf> That's why it's better, yes.
18:56 < dgreensp> I'll have to understand idiomatic use of packages better,
compared to Java and Python packages; I'm looking at the "freetype-go" project,
which has five source files and three packages; I guess the nested packages are
"installed" into GOROOT before the outer package can compile against them
18:56 < dgreensp> it feels heavyweight but maybe it's not
18:57 < Namegduf> Sounds like the project is using them poorly.
18:58 < Namegduf> Maybe.
18:59 < dgreensp> anyway, thanks for the explanation
19:07 -!- dgreensp [~dgreenspa@68-185-89-44.dhcp.snlo.ca.charter.com] has quit
[Quit: dgreensp]
19:09 -!- saschpe [~quassel@opensuse/member/saschpe] has quit [Remote host closed
the connection]
19:10 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
19:22 -!- femtoo [~femto@95-89-196-125-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
19:23 -!- tensai_cirno [~cirno@] has joined #go-nuts
19:23 < tensai_cirno> hello again
19:23 < tensai_cirno> any1 can check this paste, it is gccgo related →
19:23 < tensai_cirno> troubles with linking with SDL
19:24 < tensai_cirno> gccgo cannot link with SDL_LoadBMP, but same plain
oldie C code works fine
19:25 -!- jo___ [~Jo@p4FEB6DCE.dip.t-dialin.net] has quit [Quit: This computer has
gone to sleep]
19:28 < nsf> .йгше
19:28 < nsf> oops
19:28 < nsf> sorry :)
19:28 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
19:29 -!- illya77 [~illya77@150-69-133-95.pool.ukrtel.net] has joined #go-nuts
19:31 -!- watr_ [~watr@] has quit [Ping timeout: 255 seconds]
19:38 < tensai_cirno> will try with fresh gcc from trunk
19:40 -!- wrtp [~rog@] has joined #go-nuts
19:40 -!- Scorchin [~Scorchin@host109-154-144-120.range109-154.btcentralplus.com]
has joined #go-nuts
19:42 < aiju> tensai_cirno: given that nick, do you run Plan *9*?
19:52 -!- creack [~charme_g@] has quit [Ping timeout: 265 seconds]
19:56 < tensai_cirno> aiju, lol
19:56 < tensai_cirno> nope, only inferno
20:03 -!- pure_x01 [~pure@h-4-84.A155.priv.bahnhof.se] has quit [Quit: Ex-Chat]
20:03 -!- wrtp [~rog@] has quit [Ping timeout: 272 seconds]
20:05 -!- creack [~charme_g@] has joined #go-nuts
20:07 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has quit
[Quit: skelterjohn]
20:07 -!- plediii [~plediii@nat-168-7-237-209.rice.edu] has quit [Quit: plediii]
20:09 -!- wrtp [~rog@] has joined #go-nuts
20:15 -!- Fish- [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
20:16 -!- Fish- [~Fish@9fans.fr] has joined #go-nuts
20:29 -!- illya77 [~illya77@150-69-133-95.pool.ukrtel.net] has quit [Read error:
Connection reset by peer]
20:37 < aiju> somehow, the code in my goroutine is never executed o.O
20:39 -!- _DerHorst_ [~Horst@e176127179.adsl.alicedsl.de] has quit [Remote host
closed the connection]
20:41 < aiju> i suppose one goroutine can't eat all CPU time
20:41 < Archwyrm> aiju: If your main loop exits, all goroutines exit.
20:41 < aiju> Archwyrm: that's not my problem
20:41 < aiju> i have one goroutine which performs heavy computations
20:42 < aiju> and another one which is waiting for stuff to happen and is
never executed
20:42 < aiju> works fine if i set GOMAXPROCS to more than 1
20:42 < Archwyrm> Ah..  Paste?
20:42 < aiju> what do you mean?
20:44 < Archwyrm> aiju: If you paste your code in a pastebin, I (and
probably others) would be happy to take a look.
20:45 < aiju> http://phicode.de/git/?p=gb.git;a=summary
20:45 < Archwyrm> I suppose that works too.  :)
20:46 < aiju> the goroutine in question is in ppu.go
20:47 < Archwyrm> The eventloop?
20:47 < aiju> yeah
20:48 < Archwyrm> Well, since those events are supposed to come from sdl, it
seems more like an SDL related question rather than goroutine related.
20:49 < aiju> no
20:49 < aiju> if i put fmt.Printf("hello\n") on top of that routine, it will
never be printed with GOMAXPROCS == 1
20:50 < Archwyrm> Hmm..  That's strange.
20:51 < Archwyrm> I usually get deadlock panics if things are blocked up
with GOMAXPROCS == 1
20:52 < Archwyrm> You're not supposed to pump events into that channel
yourself are you?  (I've never used GoSDL)
20:53 < aiju> nono
20:55 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
20:56 < TheSeeker> what's the difference between Banthar's Go-SDL and
20:56 < TheSeeker> ?
20:56 < aiju> you're utf-8 is broken ;)
20:57 < exch> At some point Banthar's was behind a fair bit.  Not sure if
his repo has been updated with the changes now though
20:59 < exch> banthars version isn't threadsafe apparently.  Along with some
other differences
20:59 < aiju> *your
21:07 -!- TheMue [~TheMue@p5DDF616B.dip.t-dialin.net] has quit [Quit: TheMue]
21:08 -!- kashia [~kb@port-92-200-52-15.dynamic.qsc.de] has joined #go-nuts
21:09 < Namegduf> Hmm.
21:09 < Namegduf> I wish Go had critical sections.
21:10 < nsf> what's wrong with mutex?  or what do you mean by critical
21:10 < Namegduf> Mutex is slow, basically.
21:10 < nsf> well, but you need to sync critical sections somehow
21:10 < nsf> and people use mutex for that
21:11 < Namegduf> The basic flow of this is: A socket becomes readable, a
command is received, that goroutine does a bunch of little small operations that
alter server state and other goroutines cannot step on, and then goes back to
21:11 < Namegduf> These small operations are slow because of locking and
unlocking mutexes.
21:11 < nsf> why can't you lock once and do them all
21:11 < nsf> and then unlock
21:12 < Namegduf> Basically because it's calling across packages
21:16 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has quit [Ping
timeout: 245 seconds]
21:17 -!- Netsplit *.net <-> *.split quits: segy, rejb, tux21b, djcapelis,
Scorchin, kimelto, Rennex, Cobi, jesusaurus, tvw, (+93 more, use /NETSPLIT to show
all of them)
21:19 -!- Netsplit *.net <-> *.split quits: XenoPhoenix
21:19 -!- pothos_ [~pothos@111-240-221-234.dynamic.hinet.net] has joined #go-nuts
21:20 -!- ronnyy [~quassel@drsd-d9ba8c99.pool.mediaWays.net] has joined #go-nuts
21:20 -!- Netsplit over, joins: Cobi, KBme, yiyus, Fish-, rejb, sl, aiju,
ExtraSpice, espeed, tsung_ (+94 more)
21:20 < Namegduf> My goal was to compare a concurrent implementation of a
highly modular server in Go with less modular, non-concurrent C implementations
21:20 -!- sauerbraten [~sauerbrat@p508CCB1D.dip.t-dialin.net] has quit [Read
error: Connection reset by peer]
21:20 -!- ronnyy [~quassel@drsd-d9ba8c99.pool.mediaWays.net] has quit [Remote host
closed the connection]
21:20 -!- aiju [~aiju@unaffiliated/aiju] has left #go-nuts ["'x𒍅񥐴񖞅񦍥񸥅񧕨)򕕂'"]
21:20 -!- noktoborus [debian-tor@gateway/tor-sasl/noktoborus] has joined #go-nuts
21:20 -!- pothos [~pothos@111-240-221-234.dynamic.hinet.net] has quit [Write
error: Connection reset by peer]
21:20 < nsf> Namegduf: btw, why do you need things like that:
21:20 < nsf> modules_* stuff
21:21 < Namegduf> nsf: To force it to link them in
21:21 < Namegduf> Modules call into the core via hooks in init()
21:21 < nsf> afaik there is a way to do that without '_ = ' assignments
21:21 < Namegduf> Not visa versa
21:21 < nsf> import _ "mymodule"
21:21 < Namegduf> Hmm, does that actually make it import it?
21:21 < nsf> yes
21:21 < nsf> that form exists for a sole purpose
21:21 < nsf> of doing init() stuff
21:21 < Namegduf> Eventually it will store the names somewhere so they can
be requested and viewed, so it isn't that important, but good to know.
21:22 < Namegduf> Those imports will eventually be generated by the build
system, too.
21:22 < Namegduf> Also that yield doesn't work, I should take it out, heh.
21:24 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has joined
21:25 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has quit
[Client Quit]
21:28 < nsf> lol, it's funny that godoc hosts the full Go web site as well
21:28 < nsf> http://eu.beshir.org:6060
21:29 < Namegduf> It is.
21:30 < exch> it seems the 'OddComm' link always points to a directory
inside the currently opened one
21:35 -!- DarthShrine [~angus@pdpc/supporter/student/DarthShrine] has joined
21:42 < uriel> 21:09 < Namegduf> I wish Go had critical sections.
21:42 < uriel> ugh, yuck!
21:43 < uriel> what is wrong with goroutines and channels?
21:43 < nsf> they're slow
21:43 < nsf> but as I've said
21:43 < nsf> it's too early to judge that
21:44 < nsf> I'm sure someone will optimize them in future if Go won't go
21:44 < nsf> there will be papers about effecient CSP implementations :P
21:44 < nsf> efficient*
21:45 -!- zozoR [~zozoR@56346ed3.rev.stofanet.dk] has quit [Quit: Morten.  Desu~]
21:45 -!- deso [~deso@x0561a.wh30.tu-dresden.de] has quit [Remote host closed the
22:08 -!- terrex [~terrex@] has quit [Quit:
22:08 -!- rlab [~Miranda@] has quit [Read error: Connection reset by
22:13 -!- Fish- [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
22:27 -!- KirkMcDonald [~Kirk@python/site-packages/KirkMcDonald] has quit [Ping
timeout: 255 seconds]
22:41 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
22:49 -!- Maxdamantus [~Maxdamant@203-97-238-106.cable.telstraclear.net] has quit
[Ping timeout: 265 seconds]
22:49 -!- Maxdamantus [~Maxdamant@203-97-238-106.cable.telstraclear.net] has
joined #go-nuts
22:50 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has joined #go-nuts
22:55 -!- tensorpudding [~user@] has joined #go-nuts
22:55 -!- skelterjohn [~jasmuth@c-68-45-238-234.hsd1.nj.comcast.net] has joined
22:56 -!- dju_ [~dju@fsf/member/dju] has joined #go-nuts
22:59 -!- dju_ [~dju@fsf/member/dju] has quit [Client Quit]
22:59 -!- dju [~dju@fsf/member/dju] has quit [Ping timeout: 240 seconds]
23:00 -!- calsaverini [~user@] has joined #go-nuts
23:00 -!- dju [dju@fsf/member/dju] has joined #go-nuts
23:00 < calsaverini> hi
23:01 -!- dju [dju@fsf/member/dju] has quit [Read error: Connection reset by peer]
23:05 < Urtie> I am playing with a Reader, and can Peek() inside it and see
that there's data in it, but a Buffered()-call always returns 0.  What am I
missing here?
23:05 -!- napsy [~luka@] has quit [Read error: Operation timed out]
23:11 < calsaverini> Anyone have any tutorial of how to achieve polymorphism
in Go? I started learning Go a few days ago and I still can't understand how I
would achieve the same effects I can achieve with generics without the ability to
declare a generic type
23:12 < Namegduf> You can't.
23:12 < exch> calsaverini: go has no generics and no concept of type
hierarchy.  You need to let go of any such notion you have been brainwashed with
in java/c++/C#/etc
23:13 < calsaverini> yes, I wish I could
23:13 < calsaverini> :P
23:13 < Namegduf> Go does not have polymorphism, that is, the ability to use
one type in place of another, in general
23:13 < Namegduf> It has interfaces, which provide a limited sane subset of
23:13 < calsaverini> Actually I'm more of a haskell than a java programmner
23:14 < calsaverini> I am accostumed to declaring things like: f is a
function from a to b, forall types a and b.
23:14 < Namegduf> You just plain can't do that.
23:15 < Namegduf> You can have functions which accept any type with a given
set of methods.
23:15 < calsaverini> so how I can, for example, define a type that is a
generic container, like a list or something like that?
23:15 < Namegduf> That's it.
23:15 < Namegduf> You can't.
23:15 < Namegduf> Except by wrapping them in an interface{}
23:15 < calsaverini> interfaces are quite similar to Haskell's typeclasses
23:15 < exch> you can make a type that contains []interface{}.  That's the
closest you'll have.  But you will need to do a type assertion to actually use the
value as whatever it is you need
23:15 < calsaverini> hum.
23:16 < calsaverini> Let's see if I understand.
23:16 < exch> eg: myT := list[i].(T)
23:16 < calsaverini> suppose I want to create an interface List
23:16 < calsaverini> that contains two methods:
23:16 < calsaverini> one that return the head of the list
23:16 < calsaverini> and other that return the rest of the list
23:17 < exch> type List []interface{}; func (l List) Head() interface{} {
return l[0] }
23:17 < exch> or something to that effect
23:18 < calsaverini> whoa...  haha.  I don't think I got it.  Wait a min.
Let me read that code
23:18 < exch> var l List; l = append(l, "foo"); ...  ; head := l.Head();
23:20 < calsaverini> ok, I'm game
23:21 < calsaverini> Let me try something simpler
23:22 < calsaverini> I'll come back
23:22 < calsaverini> thanks for your patience
23:22 < exch> np
23:23 < calsaverini> I really think go have some fantastic concepts
23:23 < calsaverini> but, as you said
23:23 < calsaverini> I need to let go older concepts to understand the new
23:23 < uriel> calsaverini: why don't you try to write some simple project
that actually does something useful you want
23:23 < calsaverini> but chan variables are AWESOME
23:23 < exch> It requires a different way of thinking.  You can only get
used to that by just trying stuff and reading the sources for existing packages
23:24 < uriel> calsaverini: it is sually a bad idea to try to learn new
languages by coming up with abstract made up toys that based on the idea of how
the implementation should be, rather than trying to solve a real world problem
23:24 < calsaverini> uriel: I'm really not much of a programmer, you see.  I
don't really program as a professional.
23:24 < uriel> calsaverini: that is irrelevant
23:25 -!- kanru [~kanru@61-228-154-25.dynamic.hinet.net] has quit [Ping timeout:
260 seconds]
23:25 < calsaverini> uriel: I'm a physicist, and I just program to solve
simple problems of my research
23:25 < calsaverini> uriel: so I don't have many ideas about things to solve
23:25 < Namegduf> Different languages provide different tools, which are
useful to build different designs and data structures to solve problems
23:27 -!- dju [dju@at.dmz.me] has joined #go-nuts
23:27 -!- dju [dju@at.dmz.me] has quit [Changing host]
23:27 -!- dju [dju@fsf/member/dju] has joined #go-nuts
23:28 < Archwyrm> calsaverini: You can always make your own implementation
of something that you use that already exists to learn the language.
23:29 < Archwyrm> I believe the Go tutorial includes an re-implementation of
cat.  Yet another version of this is not needed, but it helps teach the language.
23:31 < exch> Whenever I learn a new language, I go for an IRC bot
implementations.  I've made dozens of those in all sorts of languages.  Since I
know how it works, I can just get on with it and focus on the language part of
solving the problem
23:32 < exch> For a phycicist I suppose you could just go with a mathy
problem you already know how to solve in other languages
23:40 < calsaverini> exch: yes, what I'm trying to do is to implement simple
linear algebra
23:42 < calsaverini> exch: I'm trying to implement vector and matrices, but
I have no idea how to make them work with multiple types - ints, bools and floats.
23:43 < calsaverini> now I'm turning to something much simpler
23:43 < calsaverini> suppose I want to create an interface of numeric types,
with an add(x,y) and multiply(x,y) methods
23:44 < calsaverini> I have no idea what the type of add and multiply should
23:45 < uriel> calsaverini: this sounds like a very bad idea for a
test/learning exercise
23:45 < uriel> way too abstract and generic (pun not intended)
23:46 < exch> you can't really generalize that for multiple numeric types.
Go is very stict about which types can be added/subtracted/etc with eachother.
interface{} would still be your best bet, but the implementation of each add()
sub() etc method will be a pain the ass
23:46 < exch> If this is the most important part of what you need for your
work, I really doubt Go is the right way to go at this point
23:47 < exch> not without generics anyways
23:47 < uriel> something like an ircbot is a perfect example of the kind of
project that is good to learn a new language
23:47 < calsaverini> hum...  it's not really that important
23:48 < calsaverini> What really brought me into trying to learn go is the
type of simulation I usually
23:48 < calsaverini> do
23:48 < calsaverini> I frequently do Monte Carlo simulations
23:48 < calsaverini> so I frequently have to run many instances of the same
random stuff with different seeds and calculate a mean and variance at the end
23:49 < calsaverini> when I saw the example of the "adder" server in the
23:49 < calsaverini> that sounded perfect
23:49 < calsaverini> but when I tried to actually implement something it
became very confuse :P
23:52 < calsaverini> ok, I'll start something put it on a pastebin and when
I have a real concrete difficulty I'll try to get back here with an actual problem
someone can help me with
23:52 < calsaverini> :P
23:53 -!- tgillespie_ [~tom@global-1-8.nat.csx.cam.ac.uk] has joined #go-nuts
23:53 < exch> good luck :)
23:54 < exch> This is the 'simplest' method I could come up with to do any
sort of 'generic' math operations.  Careful though, definite headache material
inside :p Also very slow.  https://gist.github.com/747844 I use this for a script
23:55 < exch> The tricky bit about this sort of stuff is Go's lack of
implicit conversions from one type to another.  There's a good reason they chose
to do that, but it makes these sort of usecases a bit of a pain
23:55 < exch> You could argue that Go is not really a good tool to write a
script interpreter in in the first place, but I did it anyway :p
23:56 < calsaverini> hum...
23:56 < calsaverini> that's interesting
23:56 < calsaverini> I think I understand the code
23:57 < exch> It handles all valid types for a given math operation and just
throws and InvalidOperation error when something is passed as a or b that does not
23:57 < calsaverini> yes, it's kind of boilerplatey
23:57 < uriel> calsaverini: you might (or might not) find this interesting:
23:57 -!- nf [~nf@124-168-173-235.dyn.iinet.net.au] has quit [Ping timeout: 265
23:58 -!- nf [~nf@124-168-173-235.dyn.iinet.net.au] has joined #go-nuts
23:58 -!- mode/#go-nuts [+o nf] by ChanServ
23:58 < calsaverini> exch: but I'm kind of accostumed with this kind of
23:58 < calsaverini> exch: the similar code in haskell would not be that
23:59 < exch> good, it's not giving you a heart attack then :p
23:59 < calsaverini> if I define a typeclass (similar to interface in Go)
with add and multiply, I'd have to write an instance for Int, an instance for
Double, an instance for Bool, etc, etc,
23:59 < exch> With that VM I really am pushing Go into a corner it doesnt
belong though.  Square peg, round hole kindof thing
--- Log closed Mon Dec 20 00:00:01 2010