Go Language Resources Go, golang, go... NOTE: This page ceased updating in October, 2012

--- Log opened Sun Apr 17 00:00:34 2011
--- Day changed Sun Apr 17 2011
00:00 -!- wtfness [~dsc@] has joined #go-nuts
00:02 -!- crodjer [~rohanjain@] has quit [Remote host closed the
00:02 < skelterjohn> CS journals are generally one column
00:02 < skelterjohn> conference proceedings are often two column
00:03 -!- nixness [~dsc@] has quit [Ping timeout: 246 seconds]
00:03 < vsmatck> Ah, you may be right.  I only read random stuff I find.
00:04 < vsmatck> It's nice to be corrected.  :)
00:09 < vsmatck> Also, nice of you to care enough to correct me.
00:10 < exch>
https://github.com/jteeuwen/kitten/blob/master/testdata/kitten.ktn look at it!
look at the beauty and weep
00:10 < exch> a few more of those ports and the script lang will actually be
00:13 -!- chimes [~chimes@] has quit [Quit: chimes]
00:14 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
00:48 < crazy2be> is there any way i can make mkfifo buffered?
00:48 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-zgyvzvdgacficgjz]
has quit [Ping timeout: 260 seconds]
00:48 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-txmniimemmhktjfc]
has joined #go-nuts
00:58 -!- nettok [~quassel@] has quit [Ping timeout: 240 seconds]
01:07 -!- katakuna [pie@kjal.demon.co.uk] has quit [Ping timeout: 260 seconds]
01:11 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
01:12 < crazy2be> although that's not really what i want
01:23 -!- shvntr [~shvntr@] has joined #go-nuts
01:30 < vsmatck> Hm. Channels can't carry multiple values can they?
01:30 < vsmatck> Seems like it'd be nicer if they could.  Then you could ch
<- fun()..  where fun() returns multiple values.
01:31 < vsmatck> I guess the way to do it now is to define a struct for it?
01:31 < vsmatck> A struct for the value of the channel that is.
01:32 < vsmatck> Wait.  I guess the syntax needed for that would conflice,
or at least be confusing, with existing syntax.  So nvm.
01:37 < vsmatck> Actually!  You know what you could do?
01:38 < vsmatck> Have the channel contain a function, and put what you need
inside it via closure.
01:43 -!- krutcha1 [~krutcha@S010600045a27676a.vs.shawcable.net] has quit [Quit:
01:44 < vsmatck> Same difference.  *shrug*
01:46 < vsmatck> http://pastie.org/1802357 That may be a little abusive.
01:55 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
02:00 < crazy2be> hmm does anyone here use gob reliably?
02:01 < crazy2be> i'm trying to use it with the rpc package, but i keep
getting wierd errors
02:01 < crazy2be> then eventually the rpc server crashes
02:01 < crazy2be> i.e.
02:01 < crazy2be> 2011/04/16 20:04:57 rpc: rpc: server cannot decode
request: extra data in buffer
02:01 < crazy2be> 2011/04/16 20:04:57 rpc: rpc: server cannot decode
request: gob: type mismatch in decoder: want struct type rpc.Request; got
02:04 < crazy2be> then eventually i end up with
02:04 < crazy2be> 2011/04/16 20:07:20 rpc: rpc: server cannot decode
request: extra data in buffer
02:04 < crazy2be> panic: runtime error: invalid memory address or nil
pointer dereference [recovered]
02:04 < crazy2be> panic: interface conversion: interface is
runtime.errorString, not gob.gobError
02:04 < crazy2be> :(
02:17 < uriel> crazy2be: might be worth reporting to the mailing list with a
simplified test case
02:21 < crazy2be> uriel: Well, possibly, but the json codec would probably
be a better choice in this case anyway
02:22 < crazy2be> and it works fine, save the fact that it returns an error
if there is no error on the RPC
02:23 < crazy2be> my guess is that it's not dealing well with the fact that
i use pipes, which are sparatic input
02:23 < crazy2be> or something
02:25 -!- krolaw [~krolaw@] has joined #go-nuts
02:27 -!- angasule [~angasule@] has quit [Remote host closed the
02:27 -!- vsayer [~vivek@c-67-170-236-166.hsd1.ca.comcast.net] has quit [Read
error: Connection reset by peer]
02:34 -!- foocraft [~dsc@] has quit [Read error: Connection reset by
02:36 -!- foocraft [~dsc@] has joined #go-nuts
02:40 < vsmatck> http://pastie.org/1802461 I forgot the closure earlier.
02:41 < vsmatck> That's kind-of nice because you don't have to have an extra
instantiation of a struct sitting there when you're done.
02:58 < crazy2be> hmm bash is eating my "
02:59 < crazy2be> but if i put my " in ', it's all good :)
03:00 < vsmatck> ya bash uses " to group stuff with spaces together in one
03:01 * vsmatck is a evangelical bash user.  Bourne again.
03:01 -!- foocraft [~dsc@] has quit [Quit: Leaving]
03:01 < crazy2be> huh
03:02 < crazy2be> when i use jsonrpc to call a method, and it results in an
error, the "result": {}
03:02 < vsmatck> I try to make my humor as esoteric as possible.
03:02 < vsmatck> doh
03:02 < crazy2be> but when i use it to call a method, and there is no error,
it gives a number, say 2348, set by the function
03:02 < crazy2be> which might be expected, but i set the result *before* i
return an error
03:03 < crazy2be> since it's actually a dummy in this case
03:05 < kevlar> paste a gist with some example code.
03:07 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has quit [Ping
timeout: 252 seconds]
03:10 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has joined
03:15 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has quit [Read
error: Connection reset by peer]
03:15 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has joined #go-nuts
03:19 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-txmniimemmhktjfc]
has quit [Ping timeout: 248 seconds]
03:20 -!- gtaylor [~gtaylor@64-139-83-121-Nashville.hfc.comcastbusiness.net] has
joined #go-nuts
03:24 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-hougitfktvrjchrf]
has joined #go-nuts
03:25 -!- gtaylor [~gtaylor@64-139-83-121-Nashville.hfc.comcastbusiness.net] has
quit [Quit: gtaylor]
03:28 < uriel> interesting, seems that Doozer has been made public:
03:28 < uriel> https://github.com/bmizerany/doozer
03:36 -!- manveru [~manveru@b08s28ur.corenetworks.net] has quit [Quit: ZNC -
03:40 < kevlar> is that an open source implementation of Google's Chubby?
03:40 < crazy2be> hmm is there some way to make a reader and a writer into
an io.ReadWriter?
03:40 < crazy2be> like i know i can write a struct myself easily
03:40 < kevlar> crazy2be: not if they're two separate objects
03:41 < kevlar> well, actually, you could make a struct { *Reader, *Writer }
and put them both in it.
03:41 < edsrzf> crazy2be: Create a new variable of type struct { io.Reader;
io.Writer }
03:41 < kevlar> you'd just have to define the close method.
03:41 -!- manveru [~manveru@b08s28ur.corenetworks.net] has joined #go-nuts
03:46 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
03:56 < crazy2be> :( won't run on the go playground
03:57 < crazy2be> kevlar: https://gist.github.com/923746
03:57 < crazy2be> panics at the end, but that's not important
04:02 -!- Viriix [~joseph@] has joined #go-nuts
04:03 < edsrzf> crazy2be: does it not compile, or does it not behave as
04:04 < crazy2be> edsrzf: I was just showing how jsonrpc returns a {} for
the result if there was an error, and the actual result if the error is nil
04:04 < crazy2be> even if the result has been changed to something other
than it's default value
04:05 < crazy2be> but i was investigating because i get an error from the
json decoder if the error is nil
04:08 <@adg> uriel: yes
04:11 -!- Rakko [~rakko@71-90-73-192.dhcp.ftbg.wi.charter.com] has joined #go-nuts
04:14 -!- krolaw [~krolaw@] has quit [Quit: krolaw]
04:18 < crazy2be> the wierdest part is the error i'm getting on the client
side: rpc: client protocol error: json: Unmarshal(nil *int)
04:19 -!- crodjer [~rohanjain@] has joined #go-nuts
04:23 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 246 seconds]
04:33 -!- krolaw [~krolaw@] has joined #go-nuts
04:35 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 258 seconds]
04:39 -!- iant [~iant@] has quit [Ping timeout: 252 seconds]
04:40 < Rakko> Hi goers
04:41 < crazy2be> goers as opposed to stayers?  :P
04:45 -!- fabled [~fabled@] has joined #go-nuts
04:48 < Rakko> yep
04:56 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
04:56 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
04:59 -!- Viriix [~joseph@] has left #go-nuts ["Leaving"]
05:01 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
05:01 -!- mode/#go-nuts [+v iant] by ChanServ
05:03 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-hougitfktvrjchrf]
has quit [Read error: Operation timed out]
05:07 -!- photron [~photron@port-92-201-128-6.dynamic.qsc.de] has joined #go-nuts
05:08 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-miqreviocmjnttwt]
has joined #go-nuts
05:10 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout:
246 seconds]
05:15 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:22 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
05:22 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:24 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
05:25 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:25 -!- juliankrause [~juliankra@] has joined #go-nuts
05:27 < juliankrause> So I'm playing around with go for the first time and
I'm building a library of common code for two executables as part of it.  And for
some reason I can't get any more symbols to be exposed than the first few I got
into the others ones.  No matter what additional symbols I add to the library file
the two executables don't pick them up.  And the new symbols are capitalized.
05:28 < juliankrause> Doh, Just figured it out as I explained it in full, I
wasn't rebuilding the .a
05:28 < Rakko> cool
05:29 -!- juliankrause [~juliankra@] has left #go-nuts []
05:32 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
05:33 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:35 -!- reds [~reds@pool-74-101-147-57.nycmny.fios.verizon.net] has quit [Read
error: Connection reset by peer]
05:35 -!- reds [~reds@pool-74-101-147-57.nycmny.fios.verizon.net] has joined
05:44 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:44 -!- zozoR [~Morten@56344480.rev.stofanet.dk] has joined #go-nuts
05:47 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout: 246
05:48 -!- boscop__ [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
05:49 < Rakko> is anyone working on a web framework in go?
05:49 < Rakko> or compiling to exotic targets like javascript or jvm?
05:49 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout:
246 seconds]
05:49 -!- go^lang [~newblue@] has quit [Ping timeout: 246 seconds]
05:49 < vsmatck> Hoise made web.go.  Inspired by web.py.  It's decent.
05:50 < vsmatck> There's a go interpreter for the JVM.  I know nothing about
it other than it exists.
05:52 -!- boscop__ [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout:
246 seconds]
05:53 < dforsyth> Rakko: check out the go dashboard
05:53 < Rakko> oh, cool
05:53 < Rakko> that's right...  I ran across hoisie earlier
05:54 < vsmatck> I can't find jvm go on mailing list.  Don't take my word
for it.  I recall reading something at work the other day about it but I live in a
tired stupor.
05:54 < Rakko> thanks
05:59 < edsrzf> I haven't heard anything about Go for JVM
06:11 -!- sqqqrly [~dohlemach@c-75-67-216-29.hsd1.nh.comcast.net] has joined
06:14 -!- crodjer [~rohanjain@] has quit [Remote host closed the
06:19 < crazy2be> Rakko: I'm working on a multi-process, distributed,
modular, fault-tolerant web framework, but it's not released
06:19 < crazy2be> also how can i return a []string using the rpc framework?
06:20 < crazy2be> i cannot do make(*[]string, 10), or &make([]string, 10)
06:20 < crazy2be> and if i set the return type as a []string, rpc won't pick
up on it
06:21 < crazy2be> ah nvm
06:21 < crazy2be> i was being stupid
06:21 < crazy2be> it does work with a []string, i had just renamed a type,
created a new type with the old name, and forgetten to rename all references
06:22 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
06:25 -!- firwen [~firwen@gex01-1-78-234-55-225.fbx.proxad.net] has joined
06:25 < Rakko> crazy2be: cool
06:25 < Rakko> dforsyth: http://godashboard.appspot.com/ ?
06:27 < crazy2be> what does *running = mod.IsRunning() do?
06:27 < crazy2be> is it the same as running = &mod.IsRunning()?
06:32 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
06:33 < rm445> crazy2be: there's a funny character on your 1st line, so I
can't see for sure what you're asking - is it the difference between *foo=bar and
06:34 < rm445> If so, the answer is pointer dereferencing - the first puts a
value at the location pointed to by foo, the second puts an address in foo itself.
06:35 -!- niemeyer [~niemeyer@189-30-249-127.pltce701.dsl.brasiltelecom.net.br]
has quit [Ping timeout: 240 seconds]
06:36 < crazy2be> rm445: So the difference is that one copies, and another
does not?
06:45 < dforsyth> Rakko: yes
06:47 < crazy2be> and then my next question is, why can i do *running =
mod.IsRunning(), but not running = &mod.IsRunning()?
06:48 < crazy2be> where IsRunning() returns bool
06:49 < rm445> crazy2be: right, the thing with Go is, quite often you don't
have to think about pointers too much and everything works.  But to understand
what's going on you probably have to understand what pointers do.
06:50 < rm445> When you say var foo *int, you get a pointer to int.
06:50 < rm445> That means you store the address of an int value in foo, not
an int itself.
06:51 < rm445> so you could do var bar int = 9; foo = &bar
06:51 < rm445> that sets the value of foo to the address of bar
06:51 < crazy2be> yes, although it's obfusicated somewhat by interfaces
06:52 < crazy2be> since structs are almost always passed as pointers
06:52 < crazy2be> but interfaces are almost always passed as "values"
06:52 < crazy2be> although they are actually pointers
06:52 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
06:52 < rm445> now doing *foo = 7 sets bar (and *foo) to 7
06:53 < crazy2be> rm445: but doing foo = &7 (invalid) would set foo to 7,
but not bar?
06:53 < crazy2be> and they would then be unlinked?
06:54 < rm445> yes, you can make the value of foo be some other thing and it
would no longer point to bar.
06:54 -!- dchest [~dchest@] has joined #go-nuts
06:54 < rm445> foo is just a variable, a few bytes big enough to hold an
address.  You can write addresses (of the right type) to it.
06:57 < rm445> var foo *int gets you a few bytes for an address but it
doesn't give you any extra space to actually store an int in.  In Go (and other
memory-managed languages) you often don't have to worry about getting that
storage, but you have to be aware of the issue.
06:59 -!- dju__ [dju@fsf/member/dju] has joined #go-nuts
06:59 < rm445> when mod.IsRunning returns a boolean value, you have to put
it somewhere - it isn't a variable in storage but a value returned from a function
(generally popped off a stack).
07:00 < aiju> &7 is invalid?
07:00 < aiju> really odd
07:00 < rm445> so if running is a pointer to bool, you can dereference it,
i.e.  find the actual storage for a boolean it points to, and set that value to
true or false.
07:01 < rm445> but I suspect what you really want it just running =
07:02 < crazy2be> well, yes, that's what i would like to use
07:02 < rm445> aiju: ISTR that the Go team thinks it is conceptually
07:02 < crazy2be> but the rpc package needs a pointer
07:02 < aiju> rm445: weird
07:03 < aiju> because it works for composite literals
07:03 -!- dju_ [dju@fsf/member/dju] has quit [Ping timeout: 260 seconds]
07:03 < rm445> you could make &7 allocate an int and return the adress of
it, but (my interpretation of what I read is) that that is considered to be doing
too much behind the scenes.
07:03 < aiju> rm445: well, &Foo{...} does exactly that
07:03 < aiju> so it's yet another silly inconsistency
07:04 < rm445> maybe.  I think &int{7} should work but I'm less sure about
07:04 < aiju> int{7} is invalid
07:05 < rm445> I thought so though I wasn't sure, as I say I think it should
07:05 < crazy2be> int(7)?
07:06 < rm445> squiggly brackets
07:06 < crazy2be> well &int{7} is kinda broken anyway
07:06 < crazy2be> with a struct, it makes sence
07:06 < crazy2be> because you use pointers for them all over the place
07:07 < crazy2be> they are big objects, expensive to copy, so you use
&Struct{...} in your NewStruct() function, among other places
07:07 < crazy2be> but you rarely want to do &int{..}, because ints are
usually about the same size as a pointer
07:08 < crazy2be> so you are just adding an indirection
07:09 < rm445> the syntax saves you doing var s struct foo; s.a=1; s.b=2;
s.c=3; return &s
07:09 -!- coudX [~coud@] has joined #go-nuts
07:09 < crazy2be> exactly
07:09 < crazy2be> i mean, there is hardly any usage case for &7
07:09 < rm445> I think type myInt int; foo := &myInt{7} probably works
07:10 < rm445> so not having foo := &int{7} is a bit inconsistent.
07:10 -!- coudX [~coud@] has quit [Read error: Connection reset by
07:10 < aiju> crazy2be: it's still a fucking inconsistency and there *are*
use cases
07:10 -!- go^lang [~newblue@] has joined #go-nuts
07:11 < crazy2be> rm445: gives "invalid type for composite literal: mytype"
for me
07:11 < aiju> }:wq
07:11 < aiju> oh sorry
07:11 < Rakko> mustachevim
07:11 < aiju> haha
07:12 < crazy2be> aiju: It's not an inconsitancy at all, ints are integral
types, structs are treated differently
07:12 < crazy2be> aiju: It's the same for all the other builtin types
07:12 < aiju> it sure is inconsistent, just because it makes sense in some
way doesn't seem it's inconsistent
07:12 < aiju> +not
07:12 < crazy2be> only structs have the special behavior
07:13 < aiju> yeah
07:13 < crazy2be> you can't do &[]int{34, 35} either
07:13 < aiju> yup, seems completely arbitrary to me
07:14 < crazy2be> on another note, rpc keeps crashing
07:15 < crazy2be> with the entire stack trace for the crashing thread in
library code
07:15 < crazy2be> no idea how to debug this one
07:25 < crazy2be> hrmph
07:29 < crazy2be> os.Wait() just seems to be totally wrong
07:29 < crazy2be> oh well
07:29 < crazy2be> night all
07:29 < Rakko> night
07:44 -!- crazy2be [~crazy2be@d209-89-248-73.abhsia.telus.net] has quit [Ping
timeout: 246 seconds]
07:44 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
07:45 -!- crodjer [~rohanjain@] has joined #go-nuts
07:46 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has joined #go-nuts
07:46 -!- ExtraSpice [XtraSpice@] has joined #go-nuts
07:54 -!- krolaw [~krolaw@] has quit [Quit: krolaw]
07:54 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
07:54 -!- randfur [~androirc@] has joined #go-nuts
07:58 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has quit [Quit:
07:58 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
07:59 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout: 246
08:00 -!- boscop_ [~boscop@f055210242.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
08:01 -!- huin [~huin@] has joined #go-nuts
08:01 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has joined #go-nuts
08:02 -!- randfur [~androirc@] has quit [Ping timeout: 246 seconds]
08:04 -!- krolaw [~krolaw@] has joined #go-nuts
08:06 -!- boscop [~boscop@f055210242.adsl.alicedsl.de] has quit [Ping timeout: 250
08:11 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
08:15 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has joined
08:15 -!- ShadowIce
[~pyoro@HSI-KBW-109-193-120-162.hsi7.kabel-badenwuerttemberg.de] has quit
[Changing host]
08:15 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
08:18 -!- Rakko [~rakko@71-90-73-192.dhcp.ftbg.wi.charter.com] has quit [Quit:
08:22 -!- napsy [~luka@APN-122-22-185-gprs.simobil.net] has joined #go-nuts
08:29 -!- hopso [58734516@gateway/web/freenode/ip.] has joined
08:42 -!- napsy [~luka@APN-122-22-185-gprs.simobil.net] has quit [Ping timeout:
260 seconds]
08:56 -!- aa_ [~ali@pida.vm.bytemark.co.uk] has joined #go-nuts
08:57 < aa_> hi everyone :)
08:59 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has joined #go-nuts
09:00 -!- napsy [~luka@APN-122-85-43-gprs.simobil.net] has joined #go-nuts
09:00 -!- go^lang [~newblue@] has quit [Ping timeout: 240 seconds]
09:00 -!- XenoPhoenix [~Xeno@cpc13-aztw24-2-0-cust23.aztw.cable.virginmedia.com]
has joined #go-nuts
09:04 < jessta_> hi
09:11 -!- crodjer [~rohanjain@] has quit [Quit: Leaving]
09:11 -!- crodjer [~rohanjain@] has joined #go-nuts
09:12 -!- rlab [~Miranda@149-167-113-92.pool.ukrtel.net] has joined #go-nuts
09:22 -!- crodjer [~rohanjain@] has quit [Remote host closed the
09:24 -!- crodjer [~rohanjain@] has joined #go-nuts
09:42 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has quit [Remote
host closed the connection]
09:58 -!- katakuna [~pie@kjal.demon.co.uk] has joined #go-nuts
09:58 -!- hopso [58734516@gateway/web/freenode/ip.] has quit [Quit:
Page closed]
09:59 -!- arun_ [~arun@unaffiliated/sindian] has quit [Ping timeout: 246 seconds]
10:01 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
10:04 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Ping
timeout: 246 seconds]
10:09 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-159-143.clienti.tiscali.it] has
joined #go-nuts
10:12 -!- arun_ [~arun@unaffiliated/sindian] has joined #go-nuts
10:14 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has joined
10:30 -!- coudX [~coud@] has joined #go-nuts
10:31 -!- krolaw [~krolaw@] has quit [Quit: krolaw]
10:51 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
11:08 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has quit [Ping
timeout: 250 seconds]
11:13 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
11:17 -!- coudXX [~coud@] has joined #go-nuts
11:17 -!- coudX [~coud@] has quit [Read error: Connection reset by
11:17 -!- coudX [~coud@] has joined #go-nuts
11:17 -!- coudXX [~coud@] has quit [Read error: Connection reset by
11:30 -!- ExtraSpice [XtraSpice@] has quit [Ping timeout: 276
11:33 -!- saschpe [~quassel@opensuse/member/saschpe] has joined #go-nuts
11:44 -!- ExtraSpice [XtraSpice@] has joined #go-nuts
11:47 -!- napsy [~luka@APN-122-85-43-gprs.simobil.net] has quit [Ping timeout: 252
11:47 -!- napsy [~luka@] has joined #go-nuts
11:54 -!- firwen [~firwen@gex01-1-78-234-55-225.fbx.proxad.net] has quit [Quit:
Geek insindeĀ®]
12:08 -!- angasule [~angasule@] has joined #go-nuts
12:13 -!- rutkowski [~adrian@078088207185.walbrzych.vectranet.pl] has joined
12:16 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-151-94.clienti.tiscali.it] has
joined #go-nuts
12:19 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-159-143.clienti.tiscali.it] has
quit [Ping timeout: 252 seconds]
12:21 -!- boscop [~boscop@f055020115.adsl.alicedsl.de] has joined #go-nuts
12:24 -!- bXi [bluepunk@irssi.co.uk] has quit [Ping timeout: 240 seconds]
12:25 -!- bXi [bluepunk@irssi.co.uk] has joined #go-nuts
12:26 -!- photron [~photron@port-92-201-128-6.dynamic.qsc.de] has quit [Ping
timeout: 240 seconds]
12:36 -!- GeertJohan [~Squarc@D978EC5D.cm-3-1d.dynamic.ziggo.nl] has joined
12:37 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
12:38 -!- msmul [~msmul@ip70-162-22-180.ph.ph.cox.net] has joined #go-nuts
12:43 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Read error: Connection reset by peer]
12:45 -!- msmul [~msmul@ip70-162-22-180.ph.ph.cox.net] has left #go-nuts []
13:19 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has joined
13:30 -!- Chopinnn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has joined #go-nuts
13:31 -!- Chopinnn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has quit [Read
error: Connection reset by peer]
13:31 -!- Chopinn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has quit [Read error:
Connection reset by peer]
13:32 -!- Chopinn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has joined #go-nuts
13:36 -!- karpar [~user@] has joined #go-nuts
13:42 -!- TheMue [~TheMue@p5DDF53CD.dip.t-dialin.net] has joined #go-nuts
13:42 < taruti> any good ideas on implementing large state machines?
13:44 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-182-95.clienti.tiscali.it] has
joined #go-nuts
13:45 <@adg> i'm good at writing programs that generate state machines
13:45 <@adg> ;)
13:47 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-151-94.clienti.tiscali.it] has
quit [Ping timeout: 264 seconds]
13:51 < nsf> taruti: http://www.complang.org/ragel/
13:52 < nsf> trunk version supports Go
13:53 < nsf> it also supports low level language using which you can
describe states directly
13:53 < nsf> and therefore form state machines
13:54 < taruti> thanks
14:16 -!- zozoR [~Morten@56344480.rev.stofanet.dk] has quit [Remote host closed
the connection]
14:20 < scyth> I never understood the difference between state machines and
14:21 < nsf> I never wanted to know if there is any difference
14:21 < nsf> :)
14:22 < scyth> :)
14:22 < scyth> well, graph representations look different :)
14:23 < scyth> lots of bubbles here and there :)
14:27 -!- d_m [~d_m@] has quit [Ping timeout: 276 seconds]
14:28 -!- d_m [~d_m@] has joined #go-nuts
14:29 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has quit [Quit: So
Long, and Thanks for All the Fish]
14:30 -!- coudXX [~coud@] has joined #go-nuts
14:30 -!- coudX [~coud@] has quit [Read error: Connection reset by
14:33 -!- karpar [~user@] has quit [Quit: Yow!  Legally-imposed
14:37 -!- firwen [~firwen@] has joined #go-nuts
14:37 -!- shvntr [~shvntr@] has quit [Quit: leaving]
14:49 < skelterjohn> a state machine is one sort of algorithm
14:49 < skelterjohn> that's all
15:02 < Namegduf> State machines have a specific class of algorithm they can
15:03 < Namegduf> Which is why they can be interesting
15:03 < aiju> isn't any algorithm is a state machine?
15:03 < Namegduf> But that's about it.
15:03 < aiju> -is
15:03 <@adg> aiju: no
15:03 < Namegduf> No.
15:03 < aiju> example of one which isn't?
15:03 < Namegduf> Checking whether the count of brackets in a line matches.
15:03 <@adg> this is what people mean when they say "state machine"
15:03 < aiju> i never said it had to be finit
15:03 < aiju> +e
15:04 < skelterjohn> a pushdown automaton can do what Namegduf says
15:04 <@adg> anything that can count isn't really a state machine
15:04 < skelterjohn> i was just googling about this
15:04 < skelterjohn> http://portal.acm.org/citation.cfm?id=1739947.1740155
15:04 < aiju> just have one state for each number
15:04 < skelterjohn> adg: isn't a *finite* state machine
15:04 < skelterjohn> aiju: the finite issue comes up there
15:04 <@adg> maybe you can stretch teh definition forever, but then what'
sthe point of describing anything as a "State machine" ?
15:05 < Namegduf> My example is totally relevant, because it's why a lexer
can't decide not to insert semicolons if there are unmatched brackets.
15:05 < Namegduf> Well, shouldn't.
15:05 < aiju> adg: it's yet another computing model
15:06 < skelterjohn> people talk about state machines, people talk about
finite state machines, people talk about pushdown automata
15:06 < skelterjohn> all are state machines
15:07 < Namegduf> A pushdown automaton is about as much a state machine as a
Turing machine, yes?
15:07 < Namegduf> I'm wondering if there's some distinction that makes
"state machine" still useful or if it's just been reduced to meaninglessness
15:07 < Namegduf> I think the meaning was clear enough, anyway.
15:08 < aiju> Namegduf: "turing machine" isn't meaningless either
15:09 -!- foocraft [~dsc@] has joined #go-nuts
15:10 < skelterjohn> it's not clear to me, but i think that paper i linked
to makes a connection between some type of turing machine and some type of
"two-way nondeterministic pushdown automaton"
15:10 < skelterjohn> but that's not my area of expertise...
15:10 < skelterjohn> so it's hard for me to be sure
15:10 < Namegduf> Two stack pushdown automatons are equivalent to Turing
15:10 < Namegduf> I forget how/why, I just remember that they are.
15:10 < skelterjohn> cool
15:11 -!- nixness [~dsc@] has joined #go-nuts
15:11 < aiju> i think a finite state machine is equivalent to a limited band
Turing machine
15:11 < aiju> or whatever they were called
15:12 < skelterjohn> i can believe that
15:12 < skelterjohn> a finite state machine can recognize any finite
15:12 < aiju> so any C program is equivalent to a finite state machine
15:12 < skelterjohn> finite length language
15:12 < skelterjohn> no...
15:13 < skelterjohn> well
15:13 < skelterjohn> because memory is limited?
15:13 < skelterjohn> but memory limits aren't part of the C language
15:13 < skelterjohn> that's an implementation detail
15:13 < aiju> i mean real C programs
15:13 <@adg> put it this way: if the system has finite storage, you can
express the system as a finite state machine
15:14 < skelterjohn> aiju: not a useful distinction when talking about
computational power =p
15:14 <@adg> but that's a bit of a perversion of the concept.  the state
machine would consist of every possible state of that system
15:14 -!- foocraft [~dsc@] has quit [Ping timeout: 250 seconds]
15:15 <@adg> and even a megabyte of ram has 256^1000000 possible states
15:15 <@adg> erk, one too many zeros there
15:15 < aiju> hell, that's theory man
15:15 <@adg> most c programs are not state machines
15:19 -!- niemeyer [~niemeyer@] has joined
15:23 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has quit [Quit:
15:30 * ww likes state machines...  doesn't use them often enough
15:31 < angasule> hmm, there are no isAlpha or isNumeric, etc functions for
15:33 < exch> angasule: try in the unicode package
15:33 < exch> they operate on individual unicode runes though, not entire
15:35 < ww> angasule: i often do if _, err := strconv.Atoi(s); err != nil {
bork }
15:35 < ww> but that's when the whole string is expected to be a
representation of an integer so might not work for your case
15:42 -!- niemeyer [~niemeyer@] has quit
[Ping timeout: 240 seconds]
15:45 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has joined
15:47 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
15:51 < ww> you know what the best thing about Go is?  i've not had a single
problem handling unicode
15:51 * ww is so tired of python throwing random errors as soon as you try to put
real human-created text through it
15:55 < uriel> the state of UTF-8 support in most languages is quite
15:55 < uriel> Python is beyond ridiculous in this, and python3 is not much
better (and perhaps worse)
15:58 < aiju> python's utf-8 support is totally broken
15:58 < aiju> because they got utf-8 TOTALLY wrong
15:58 < aiju> almost as bad as windows
15:58 < uriel> or java *yuck*
15:58 < uriel> (windows and java got it almost equally bad, it is hard to
tell which one is worse)
16:00 -!- rutkowski [~adrian@078088207185.walbrzych.vectranet.pl] has quit [Quit:
WeeChat 0.3.3-dev]
16:02 < aiju> uriel: i can't imagine any implementation being worse than
16:04 < uriel> http://en.wikipedia.org/wiki/Utf-8#Modified_UTF-8
16:06 < aiju> uriel: as long as it doesn't put BOMs in there ..
16:10 < aiju> uriel: i can imagine C# putting BOMs in strings or something
16:30 -!- crazy2be [~crazy2be@d209-89-248-73.abhsia.telus.net] has joined #go-nuts
16:33 -!- zimsim [~simon@] has joined #go-nuts
16:44 < plexdev> http://is.gd/h8QlWD by [Dave Cheney] in
go/src/pkg/websocket/ -- websocket: fix socket leak in test
16:44 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-155-183.clienti.tiscali.it] has
joined #go-nuts
16:47 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-182-95.clienti.tiscali.it] has
quit [Ping timeout: 258 seconds]
16:49 < Namegduf> I wish there were fewer things which index by codepoint.
16:49 < Namegduf> It just isn't reliable.
16:52 < aiju> "index by codepoint"?
16:53 -!- nixness [~dsc@] has quit [Ping timeout: 260 seconds]
16:55 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-155-183.clienti.tiscali.it] has
quit [Ping timeout: 252 seconds]
16:57 < uriel> and index by magic pixie dust instead?
17:05 < Namegduf> Either do the painful process of actually indexing by
character correctly, including combining marks and other magic, or don't index at
all because you clearly don't need it to actually work reliably.
17:05 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
17:05 < aiju> sadly, unicode is pretty much insane
17:06 < exch> yea..  everyone should just learn english
17:06 < aiju> exch: that too, but still
17:06 < aiju> zero-width spaces, combining marks etc
17:10 < uriel> exch: its got nothing to do with learning english, so spare
us the strawman
17:11 -!- angasule [~angasule@] has quit [Remote host closed the
17:11 < crazy2be> hrmph
17:12 < crazy2be> durp
17:12 < crazy2be> waitmsg.WaitStatus.Exited() returns true always if you
call os.Wait() with WNOHANG
17:13 < exch> uriel: strawmen are prevalent here.  Just keeping up with the
17:13 < uriel> heh
17:21 < nsf> http://ompldr.org/vOGI1bg/2011-04-17-232615_956x382_scrot.png
17:21 < nsf> yay!  first valid code generated by crawl
17:22 < nsf> hello world without \n at the end
17:22 < nsf> :D
17:22 < aiju> you can just do \\n
17:22 < nsf> (escaping code is missing)
17:22 < nsf> aiju: no, it won't work
17:22 < aiju> why not?
17:22 < nsf> hm, it works
17:22 < nsf> interesting :)
17:23 < nsf> ah, of course it works
17:23 < nsf> anyways..
17:27 < crazy2be> nsf: What is that?
17:27 < nsf> a compiler for the programming language I'm working on
17:27 < crazy2be> compiles to C?
17:27 < nsf> uses C as a backend for now
17:27 < nsf> yeah
17:28 < nsf> looks a lot like Go (syntax)
17:28 < uriel> shouldn't it use Go? uhu?
17:28 < nsf> but bits here and there are different
17:28 < nsf> uriel: no
17:28 < |Craig|> I don't think go is a good language to compile to for most
17:29 < crazy2be> C has the best support for libraries and such
17:29 < crazy2be> good language to compile to
17:29 < nsf> yeah, for example in code generation I use void* for every
pointer type
17:29 < nsf> because the actual pointer type is only required for type
17:29 < nsf> in Go it will be ugly
17:29 < nsf> and Go has GC
17:29 < nsf> my language has no GC
17:30 < crazy2be> nsf: What is it designed for?
17:30 < crazy2be> what usage case?
17:30 < nsf> as a C with Go syntax for now
17:30 < nsf> it is unfinished
17:31 < nsf> and I have plans beyond that
17:31 < nsf> we'll see
17:39 < firwen> do you have already tried vala or Genie nsf ?
17:39 < nsf> of course
17:39 < firwen> :)
17:39 < aiju> vala?
17:39 < nsf> sadly they repeat C's mistakes to a large extent
17:39 < aiju> vala is based on GTK
17:39 < nsf> and besides that yeah
17:39 < nsf> they use glib's object model
17:39 < nsf> I clearly don't want that
17:40 < crazy2be> hmm
17:40 < crazy2be> how do you catch signals with go?
17:40 < aiju> os/signal
17:40 -!- Viriix [~joseph@c-67-169-172-251.hsd1.ca.comcast.net] has left #go-nuts
17:40 < crazy2be> hm
17:40 < firwen> the C backend has some advantage like the protability of the
intermediate code
17:40 < crazy2be> how does that work for things like SIGINT?
17:41 < firwen> but in terms of introspection / reflectivity, it's not
17:41 < crazy2be> since it closes the program, how can i handle it?
17:41 < nsf> firwen: I use C for now, because it's easy to implement it
17:41 < nsf> later I'll switch to LLVM most likely
17:41 < firwen> yeah good choice
17:41 < aiju> free C++ madness included
17:42 < uriel> yuck
17:42 < nsf> hehe, and yeah, crawl is written in C++ :D
17:42 < nsf> although, it's very C-like
17:42 < nsf> I don't even use references if it's possible to avoid them
17:43 < nsf> and I think I have only one class that has copy constructor
17:43 < nsf> :D
17:43 < firwen> do you have a github or something, just to look over
17:43 -!- coudXX [~coud@] has quit [Read error: Connection reset by
17:43 -!- coudXX [~coud@] has joined #go-nuts
17:43 < aiju> my C++ code has only classes to interface with other C++ code
17:43 < nsf> no, not at the moment
17:44 < nsf> crawl is far from usable
17:44 < aiju> s/has only/only has/
17:44 < crazy2be> huh
17:44 -!- coudXX [~coud@] has quit [Read error: Connection reset by
17:44 < crazy2be> that's cool how os/signal works
17:46 < nsf> firwen: I have an irc channel though, but nothing useful
happens there as well, if you're interested: #crawlang
17:47 < firwen> just for fun ^^
17:49 < crazy2be> i can never remember if it's key, value := range or value,
key := range
17:51 < exch> either one
17:51 < exch> the first copies the values though
17:51 < exch> if I remember correctly, that is
17:58 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has joined
18:07 -!- `micro` [~quassel@96-42-224-166.dhcp.roch.mn.charter.com] has quit [Ping
timeout: 246 seconds]
18:09 -!- Chopinnn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has joined #go-nuts
18:09 -!- Chopinnn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has quit [Read
error: Connection reset by peer]
18:09 -!- Chopinn [~Chopin@ti0018a380-dhcp0864.bb.online.no] has quit [Read error:
Connection reset by peer]
18:10 < uriel> exch: I'm not sure what you mean, but I don't think it can be
18:11 < exch> oh dur.  I missed the 'value, ' bit in the second part
18:11 -!- irclol [irclol@fettemama.org] has joined #go-nuts
18:11 -!- micromatikal [~quassel@96-42-224-166.dhcp.roch.mn.charter.com] has
joined #go-nuts
18:17 < plexdev> http://is.gd/5oY17r by [Russ Cox] in go/lib/codereview/ --
codereview: add 'hg undo' command
18:17 < plexdev> http://is.gd/GnQ8eV by [Russ Cox] in
go/src/pkg/runtime/arm/ -- runtime: fix arm5 softfloat
18:18 -!- micromatikal [~quassel@96-42-224-166.dhcp.roch.mn.charter.com] has quit
[Ping timeout: 246 seconds]
18:20 < skelterjohn> it's always key, value := range
18:20 < skelterjohn> whether its a slice or a map
18:23 < str1ngs> is there a ways to do with with just slice notation .
18:26 < crazy2be> srt1ngs: In python it would be foo[:-2] i think, but afaik
that doens't work in go
18:26 < str1ngs> yes that doesn not work it puts it out of bounds
18:27 < str1ngs> I'll read the spec see if I get get a better grasp on the
18:28 < uriel> crazy2be: the way I remember it is: the key comes before the
value, because to get the value you first need the key
18:28 < uriel> (in your mind think key -> value; or d[key] = value)
18:29 < crazy2be> uriel: That makes sence, although the last one could be
value = d[key]
18:29 < crazy2be> :P
18:29 < uriel> crazy2be: don't think of that ;P
18:29 < uriel> the key points to -> the value
18:33 < str1ngs> I cant see away around foo[0:len(foo)-2] so I'll just keep
it this way I guess
18:34 < uriel> str1ngs: there is nothing wrong with that
18:34 < str1ngs> no its ok, was trying to get a better grasp on the notation
18:35 < str1ngs> its alot better then what I orginally had lol
18:35 < crazy2be> it's mostly annoying when you have
18:35 < crazy2be> but then you can just use a tempoary
18:38 < str1ngs> filepath.Glob is awesome
18:48 < groves> I'm reading a bunch of values from an io.Reader, which I'd
like to let a caller process as they're read instead of returning all of them.  Is
a channel the go way to express that kind of iteration?
18:49 < groves> I don't need synchronization, so it seems like there's some
needless overhead there.  However, a channel can be used in range, which feels
more idiomatic than defining my own iterator interface.
18:54 -!- niemeyer [~niemeyer@] has joined
18:54 < TheMue> groves: If it's pure serial you don't need channels and
18:55 < groves> Is there a way to use range for my own data without
18:55 < TheMue> groves: But if multiple goroutines can handle each element
in parallel - maybe processing lasts longer than reading - then it's worth the
18:55 < aiju> TheMue: goroutines are not a mere performance device
18:55 < groves> Or should I not be worried about inflicting my own Iterator
interface on people?
18:55 < TheMue> aiju: I know
18:55 < aiju> i'd argue that channels are the idiomatic to do that
18:55 < aiju> +way
18:55 -!- angasule [~angasule@] has joined #go-nuts
18:57 < TheMue> I would split reading and processing into two goroutines and
pass the data via a channel.
18:58 < TheMue> And in case that delivery is faster then processing using
multiple goroutines.
18:58 < aa_> I'm a totaly newbie so sorry if this sounds awful, but I don't
understand these constructorish literal things, like in the tutorial they use
File() can someone explain this please?
18:59 < aiju> File() is a function
18:59 < aa_> oh
19:00 < groves> How should I pass errors back to the readers if something
blows up in io or decoding?  It looks like channels only pass a single type, so I
can't use the value, err pattern that most go stuff uses.  Does that mean I define
a struct with the value and error or?
19:01 < aa_> aiju:
19:01 < aiju> aa_: oh right
19:01 < aiju> aa_: it's really a constructor
19:01 < groves> That feels weird with multiple goroutines reading from the
channel, since only one will see the error.  Maybe return two channels, one with
the values, and a second that will pass back a single error if the first channel
closed because of one?
19:02 < aa_> aiju: does it return the same thing as new(File) ?
19:02 < aiju> no
19:02 < aiju> new(File) returns an empty *File
19:02 < aiju> new(File) is the same as &File{}
19:03 < aa_> ok, cool, thanks, makes sense
19:09 -!- niemeyer_ [~niemeyer@] has joined
19:10 < crazy2be> groves: That seems to be how it is done in other places
19:10 < groves> Cool, where are you seeing this?
19:10 < crazy2be> then the goroutine can use select{} to chose a channel
19:10 < crazy2be> and if there is an error in the error channel it can
process that
19:11 < crazy2be> well, let's see if i can find a specific example
19:11 < crazy2be> path/filepath uses an error channel for the walkers, but
that's not exactly the same
19:12 < groves> Don't worry about doing a big search, I just assumed you
were looking at something when you mentioned other places
19:12 < crazy2be> well i've *seen* it in other places
19:12 < crazy2be> just not sure where off the top of my head :P
19:12 -!- niemeyer [~niemeyer@] has quit
[Ping timeout: 240 seconds]
19:13 < crazy2be> at the end of the go tutorial they use that teqnique for
multiplexing: http://golang.org/doc/go_tutorial.html
19:13 < crazy2be> a request channel and a quit channel
19:14 < groves> Excellent, sounds like it's a reasonable technique then.
Thanks for the help!
19:15 < crazy2be> no problem
19:17 -!- bortzmeyer [~stephane@lan31-2-82-224-72-72.fbx.proxad.net] has joined
19:17 < crazy2be> groves: what are you writing?
19:21 < bortzmeyer> First time I have to do an exponentiation in Go and I'm
not able to find, in the language spec, how to do it.  It seems neither ^nor **
19:21 < crazy2be> math.Pow()?
19:21 < crazy2be> not srue if that even exists, just guessing
19:22 < crazy2be> math.Exp()
19:22 < crazy2be> on wait
19:22 < groves> An implementation of Avro:
19:22 < bortzmeyer> crazy2be: thanks.  I don't know why, I was sure there
was a builtin operator
19:23 < crazy2be> ah it is math.Pow()
19:23 < crazy2be> i was right on my first guess :P
19:23 < crazy2be> bortzmeyer: Most languages have it, but it's not an
oft-used enough tunction to be built into the language imo
19:23 < bortzmeyer> crazy2be: http://golang.org/pkg/math/#Pow
19:24 < crazy2be> *s/tunction/function
19:25 < bortzmeyer> crazy2be: not having it in the language itself would not
be a problem if we had the ability to create operators...  (yes, I know it is a
touchy question and already discussed)
19:25 < crazy2be> bortzmeyer: How often do you actually use it?
19:25 < bortzmeyer> crazy2be: my first time since I use Go :-)
19:26 < bortzmeyer> BUt I'm not a mathematician
19:26 < crazy2be> math.Pow(x, y) is fairly short and obvious :P
19:26 < crazy2be> go is not a mathamatician's language
19:26 < bortzmeyer> Fortran is
19:27 < crazy2be> regardless, x^y is hardly cleaner than math.Pow(), unless
you are doing it quite often
19:28 < aiju> for common cases like x^2 or x^3 just write it out
19:28 < crazy2be> and if you are doing it quite often, you can just define
func pow(x, y float64) float64 { return math.Pow(x, y) }
19:29 < bortzmeyer> crazy2be: func pow does not buy you much : the args are
still not in the "normal", "mathematical" order
19:30 < crazy2be> bortzmeyer: What do you mean?
19:30 < aiju> infix notation
19:31 < aiju> do Java/C# have an exponentiation operator?
19:31 < bortzmeyer> Yes, the normal exponentiation operator is infix,
math.Pow is prefix.
19:32 < crazy2be> ah, because it's between the operators you mean?
19:33 < crazy2be> you could do type base int; func (b base) pow(y int64)
int64 { return math.Pow(b, y) }
19:33 < rm445> crazy2be: claiming that x^y is no clearer than pow(x,y) is
stockholm syndrome.  Of course it's clearer, it's very common notation.  The
reasons for pow being a function in the math library are not clarity.
19:34 < rm445> I think basically it's because writing a math library is a
bit hard and specialised - language authors want to leave the math library to the
experts to some extent rather than get bogged down in floating-point mathematics
when writing a compiler.
19:34 < aiju> or you could just quit whining
19:36 < rm445> there's also some kind of blurry divide between operations
that don't do much, and ones that do a lot and live in a library.  Exponentiation
can be relatively complex.
19:37 < bortzmeyer> rm445: thanks, sensible explanations
19:37 < crazy2be> exponentiation is also not something computers do
"naturally" afaik
19:37 < crazy2be> unlike bit shifts, adding, subtraction, etc
19:38 < crazy2be> rm445: pow(x, y) is somewhat clearer, because you know
what is going to happen as a programmer
19:38 < aiju> crazy2be: i think there is a exponentiation instruction
19:39 < crazy2be> if you let people define operator ^, you are getting into
a land of unknown
19:39 < aiju> floating point, that is
19:39 < crazy2be> aiju: Really?
19:40 < crazy2be> well go doesn't use it in any case
19:40 < crazy2be> http://golang.org/src/pkg/math/pow.go?s=1186:1216#L28
19:42 < aiju> odd
19:43 < aiju> there doesn't seem to be any indeed
19:43 < aiju> unlike sin() and cos()
19:44 < vsmatck> The word "natural" should be banned from technical
discussion.  :)
19:44 < aiju> vsmatck: -technical
19:44 < aiju> except maybe math
19:44 < aiju> natural numbers and such
19:44 < vsmatck> agree
19:46 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
19:47 -!- dga [~dga@MOO.CMCL.CS.CMU.EDU] has joined #go-nuts
19:47 < vsmatck> There's a number of nebulous concepts in this area.  Like
intuitive vs familiar vs natural.  People like to conflate all those even though
they're different.
19:48 < vsmatck> I mean unquestionably programming languages are designed to
fit the human mind, and in that sense they're "natural".  But people generally
state some technical thing is natural when they want to put forth an idea without
any sort of evidence.
19:49 < aiju> people like to bullshit
19:49 < crazy2be> "natural" is basically the same as "familiar"
19:49 < aiju> hell, go to anyone propagating organic food if you want people
bullshitting about "natural" things
19:50 < crazy2be> lol
19:50 < crazy2be> the ads are funny
19:50 < crazy2be> they have like people with dirty hands carrying baskets of
19:50 < crazy2be> "back to nature"!
19:50 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
19:50 < crazy2be> because that's certainly how organic food works!
19:50 < exch> strange how nobody seems to realize there is no such thing as
19:51 < dga> speaking of "natural" ...  (how's that for a weak segue):
Anyone have a suggestion for the most clean / "Go-like" way to have pkg http
invoke a method for handling requests?
19:51 < dga> Right now I'm doing:
19:51 < dga> http.Handle("/query", jsonhandler(func(req *http.Request,
respmap map[string]interface{}) { server.ServeQuery(req, respmap)
19:51 < crazy2be> dga: Whaaa
19:51 < dga> but you can ignore jsonhandler (it's just a wrapper type).  The
real thing I'm curious about is that I'm creating a closure to pass to http.Handle
that invokes server.ServeQuery
19:52 -!- Fish [~Fish@9fans.fr] has quit [Ping timeout: 260 seconds]
19:52 < dga> The non-compiling thing I'm doing is: http.Handle("/query",
server.ServeQuery) --
19:54 < dga> so I just wrap it in a closure: http.Handle("/query", func
(...args...) { server.ServeQuery(...args...) }
19:54 < dga> That's fine, but it feels a little klugey.  So I'm curious if
there's A Better Way (tm).
19:55 < crazy2be> dga: What are you trying to do?  I don't completely
19:56 < crazy2be> it seems like you are trying to provide some extra data to
the http handler function?
19:56 < dga> bingo, crazy.
19:57 < dga> I want the http handler to invokve a method (ie, a function
associated with a particular instance of a struct) when it does its thing.
19:57 < crazy2be> well, just make a type foo struct {someextrainfo string}
19:57 < crazy2be> hmm
19:57 < dga> Sure.  That's what I'm doing now.  I'm curious about whether
there's a better way to do it than by creating a closure to pass to http.Handle
19:58 < crazy2be> what is the compiler error?
19:58 < crazy2be> it looked like your arguments were wrong, so i was
19:58 < dga> no, no, i have no compiler error.  The closure way works.
19:58 < crazy2be> no but without the closure
19:59 -!- zimsim [~simon@] has quit [Ping timeout: 240 seconds]
19:59 < dga> Oh, you mean if I call: http.Handle( "/query",
server.ServeQuery) ? "method server.ServeQuery is not an expression, must be
20:00 < crazy2be> so is ServeQuery a function or a struct?
20:00 < crazy2be> because you can make it a scruct, then give it a
ServeHTTP() method
20:00 < crazy2be> and that should work
20:00 < crazy2be> passing it exactly how you do now
20:01 < dga> ServeQuery is a method: func (server *Server) ServeQuery( w
http.ResponseWriter, req *http.Request)
20:01 < crazy2be> alternatively, it might work if you rename ServeQuery to
ServeHTTP(), and just pass server
20:01 < dga> crazy: That works.  But it can only have one ServeHTTP method,
and I have a few different queries I want to handle, and am hoping to reuse the
dispatch logic in http
20:02 < dga> so there's ServeQuery and ServeQuery2 and ...  etc.
20:02 < crazy2be> well, personally, i just use global variables for cases
like that
20:02 < dga> The real code is here: http://pastebin.com/0TXc88ei
20:03 -!- niemeyer_ [~niemeyer@] has quit
[Ping timeout: 240 seconds]
20:03 < crazy2be> but if you want several instances of server, you could
make each ServeQuery() into a struct or type, then define the ServeHTTP() method
on each of them
20:03 < crazy2be> oh wiat
20:03 < dga> but it's got a lot of extraneous crap around it that's not
germane to my question.  But scroll down to main() and you'll see what I'm talking
20:05 < crazy2be> well you can also do http.HandleFunc() or HandlerFunc() to
register functions as handlers
20:05 < crazy2be> that's what i use
20:05 < dga> Yup - but I still have to create a closure to pass the object
to them, AFAIK
20:06 < crazy2be> what is jsonhandler()?
20:06 -!- Soultaker [~Soultaker@] has quit [Ping timeout: 276
20:07 -!- Soultaker [~Soultaker@hell.student.utwente.nl] has joined #go-nuts
20:07 < crazy2be> ok i see
20:07 < dga> an interface type that provides a ServeHTTP method that spits
out JSON-marshaled output.  It takes a function from requests -> a map of data,
and marshals it.
20:07 -!- Fish [~Fish@9fans.fr] has joined #go-nuts
20:07 < crazy2be> i would actually do this quite differently
20:08 < dga> Most of what jsonhandler/etc.  are doing is implementing fairly
generic HTTP query string -> JSON rpc-like functionality.  But I don't want
full on JSON RPC.
20:08 < dga> I'm all ears.  :)
20:08 < crazy2be> it looks like you are a) trying to do checks at the start
of all the handlers, and b) trying to deal with their output in a consistent
20:08 < crazy2be> correct?
20:09 < dga> Yup.  Just avoiding the boilerplate in every handler.
20:09 < dga> *And* passing the same instance of "server" to every handler
20:10 < TheMue> Go is really nice.  Just implemented the discarding of
transaction of my Redis database client with almost no effort.
20:10 < crazy2be> dga: Well, you have a few options
20:11 < crazy2be> you could have a checkSanity() function at the start of
each function, and a marshalOutput() function at the end
20:12 < dga> I'll take one extra line of creating a closure over that.  :)
20:13 < crazy2be> well, lines aren't that important :P
20:14 < crazy2be> you could also use a custom ServeMux for the time tracking
and all
20:14 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.4]
20:15 < crazy2be> also why do you have results["status"] = "FAILED"?
20:15 < crazy2be> just return a error 503 or 500 or w/e is relevent
20:15 < dga> incomplete code.  Haven't entirely decided on how I want to
propagate failures back to the client yet.
20:15 -!- bortzmeyer [~stephane@lan31-2-82-224-72-72.fbx.proxad.net] has quit
[Ping timeout: 276 seconds]
20:18 -!- Soultake1 [~Soultaker@hell.student.utwente.nl] has joined #go-nuts
20:18 -!- Soultaker [~Soultaker@hell.student.utwente.nl] has quit [Read error:
Connection reset by peer]
20:18 -!- zimsim [~simon@] has joined #go-nuts
20:23 -!- saschpe [~quassel@opensuse/member/saschpe] has quit [Remote host closed
the connection]
20:23 -!- fmoo1 [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
20:24 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Ping
timeout: 246 seconds]
20:24 -!- rl [~rbl@] has quit [Ping timeout: 246 seconds]
20:24 -!- rl [~rbl@84-74-142-37.dclient.hispeed.ch] has joined #go-nuts
20:25 < crazy2be> dga: Anyway, how i do it is that i have handler functions
registered on arbitary URLs, and then they call mytemplate.Render(c, r,
"template-name", "Page Title", data)
20:25 < crazy2be> when they have generated the data and are ready to have it
20:25 < crazy2be> data is an interface{}
20:26 < crazy2be> if ?alt=json is in the URL (r.FormValue("alt") == "json"),
then it renders the data as json
20:26 < crazy2be> otherwise, it uses mustache and renders it using the
template file deternmined by the template name
20:27 < crazy2be> ideally, this would allow you to write a entirely
AJAX-based website for clients that support it
20:27 < crazy2be> and still have the fallback
20:27 < vsmatck> Mustache is quite nice.  I wonder if a mustache
implementation is a candidate for the standard library?
20:27 < crazy2be> mustache is nice, i just wish i could do {{#Foo==3}} or
20:28 < vsmatck> That goes against the design of it which I think it wise.
"logicless templates"
20:28 < vsmatck> There's always a way to do it in the backend.
20:28 -!- sqqqrly [~dohlemach@c-75-67-216-29.hsd1.nh.comcast.net] has quit [Ping
timeout: 246 seconds]
20:30 < crazy2be> vsmatck: kinda, but not really
20:30 < crazy2be> like
20:30 < crazy2be> say i want to highlight the current tab on some
navigational menu
20:31 < crazy2be> so i set ModuleName in my struct equal to "events" for the
events module
20:31 < crazy2be> now what's the best way to highlight the events module tab
if it is currently selected?
20:31 < vsmatck> To do that you can define a mustache var only if the
current element in the list is the current page.
20:32 < vsmatck> That's how I do it with my mustache pagination stuff.
20:32 < crazy2be> yeah so i make a map[string]bool
20:32 < crazy2be> and set thatmap["events"] = true
20:32 < crazy2be> but tell me that's not hackish
20:33 < vsmatck> I plan to move all my mustache stuff away from maps.  I
want to go all structs for the source variables.  Then make it case insensitive.
20:33 < vsmatck> Make it so if a struct data member is a nil pointer it
means not defined.
20:33 < vsmatck> Using maps gets really hairy.
20:34 < vsmatck> I'm not going to tell you that's not hackish..  caus it is.
20:34 -!- GeertJohan [~Squarc@D978EC5D.cm-3-1d.dynamic.ziggo.nl] has quit [Quit:
20:35 < crazy2be> ok well having a struct doesn't *really* make things too
much better
20:35 < vsmatck> Perhaps there could be a few instances where it'd be nicer
to have simple logic in the templates.  But I think too much logic in templates
makes the design brittle.
20:35 < crazy2be> yes
20:35 < crazy2be> but == would be nice
20:35 < crazy2be> :P
20:35 < crazy2be> it's the only logic i have wanted so far
20:36 < crazy2be> i might hack it into mustache
20:37 < crazy2be> although mustache basically has 1) loops, 2) bool testing
conditions, 3) functions (include is kinda like this)
20:37 < crazy2be> i would just be slightly expanding 2) to allow integer and
string comparisons
20:37 < vsmatck> The partials are nice.  The >
20:37 < crazy2be> yeah sorry by include i mean partials
20:38 < vsmatck> They should have just called them includes.  More people
would know what they're talking about.  :)
20:39 < crazy2be> yeah but then i would think of php *shudder*
20:40 < vsmatck> PHP can look nice.  You gotta have someone real talented
for that tho.  I'm not.  I programmed php for 2.5 years and it all came out
looking like crap.
20:41 < aiju> PHP can look nice, but only if the file is empty
20:41 < crazy2be> lol i wrote a website in php
20:41 < crazy2be> didn't take me long and it looked decent
20:41 < crazy2be> but like
20:42 < vsmatck> I gotta do ASP now as part of my job.  :-/
20:42 < crazy2be> when you want to go write a mobile layout, you have to
rewrite the whole thing
20:43 < vsmatck> crazy2be: I hadn't realized that advantage.  Yeah I guess
when you want to do mobile layout you just have to make a new template that uses
the same backend.  true true
20:43 -!- zozoR [~Morten@56344480.rev.stofanet.dk] has joined #go-nuts
20:44 < crazy2be> yeah that's how my framework is designed, so that the
modules should know nothing of the presentation, and the presentation should be
independed of the modules
20:44 < crazy2be> nice in theory at least
20:44 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has quit [Read
error: Connection reset by peer]
20:46 < crazy2be> but that seems to be how most websites do it, they write
the desktop layout, the rewrite the whole thing for the mobile layout
20:47 < crazy2be> and they are completely detached, with the mobile one
being at m.somesite.com
20:50 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has joined #go-nuts
20:50 -!- aho [~nya@fuld-590c75d0.pool.mediaWays.net] has joined #go-nuts
20:52 -!- firwen [~firwen@] has left #go-nuts []
21:00 -!- napsy [~luka@] has quit [Quit: Lost terminal]
21:01 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
21:02 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-miqreviocmjnttwt]
has quit [Ping timeout: 252 seconds]
21:04 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Ping
timeout: 276 seconds]
21:06 -!- dga [~dga@MOO.CMCL.CS.CMU.EDU] has quit [Quit: leaving]
21:07 -!- zozoR [~Morten@56344480.rev.stofanet.dk] has quit [Remote host closed
the connection]
21:08 -!- ampleyfly [ampleyfly@gateway/shell/blinkenshell.org/x-bxqhogdnrjbsmrcp]
has joined #go-nuts
21:08 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
21:09 -!- chressie [~chressie@dreggn.in-ulm.de] has quit [Quit: WeeChat 0.3.4]
21:10 -!- chressie [~chressie@dreggn.in-ulm.de] has joined #go-nuts
21:11 -!- tgall_foo [~tgall@] has joined #go-nuts
21:12 -!- huin [~huin@] has quit [Quit: bedtime]
21:14 -!- TheMue [~TheMue@p5DDF53CD.dip.t-dialin.net] has quit [Quit: TheMue]
21:17 -!- rlab [~Miranda@149-167-113-92.pool.ukrtel.net] has quit [Quit: Miranda
IM! Smaller, Faster, Easier.  http://miranda-im.org]
21:19 -!- Fish [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
21:22 -!- itrekkie [~itrekkie@ip98-165-247-3.ph.ph.cox.net] has joined #go-nuts
21:35 -!- vsayer [~vivek@2001:470:1f04:1a6b:21a:6bff:fe35:d2a5] has joined
21:37 -!- angasule [~angasule@] has quit [Ping timeout: 252 seconds]
21:40 -!- awidegreen [~quassel@c-cfc5e555.08-2-73746f39.cust.bredbandsbolaget.se]
has quit [Ping timeout: 258 seconds]
21:51 -!- itrekkie [~itrekkie@ip98-165-247-3.ph.ph.cox.net] has quit [Quit:
21:54 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
21:55 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has quit [Ping
timeout: 250 seconds]
22:18 -!- zimsim [~simon@] has quit [Remote host closed the
22:19 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
22:19 -!- crodjer [~rohanjain@] has quit [Quit: Leaving]
22:19 -!- Scorchin [~Scorchin@host86-145-15-38.range86-145.btcentralplus.com] has
joined #go-nuts
22:25 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has joined
22:50 -!- arun_ [~arun@unaffiliated/sindian] has quit [Ping timeout: 246 seconds]
22:54 -!- itrekkie [~itrekkie@ip98-165-247-3.ph.ph.cox.net] has joined #go-nuts
22:58 -!- Boney [~paul@124-168-103-51.dyn.iinet.net.au] has quit [Remote host
closed the connection]
23:01 -!- itrekkie [~itrekkie@ip98-165-247-3.ph.ph.cox.net] has quit [Quit:
23:08 -!- Boney [~paul@124-168-103-51.dyn.iinet.net.au] has joined #go-nuts
23:08 -!- dj2 [~dj2@CPE001f5b35feb4-CM0014048e0344.cpe.net.cable.rogers.com] has
quit [Remote host closed the connection]
23:23 -!- Scorchin [~Scorchin@host86-145-15-38.range86-145.btcentralplus.com] has
quit [Quit: Scorchin]
23:24 -!- angasule [~angasule@] has joined #go-nuts
23:30 -!- dchest [~dchest@] has quit [Quit: dchest]
23:32 -!- pphalen [~pphalen@] has joined #go-nuts
23:33 -!- fmoo1 [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
23:35 -!- aho [~nya@fuld-590c75d0.pool.mediaWays.net] has quit [Quit:
23:48 -!- dj2 [~dj2@] has joined #go-nuts
23:55 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 252 seconds]
--- Log closed Mon Apr 18 00:00:50 2011