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

--- Log opened Fri Apr 22 00:00:50 2011
00:04 -!- katakuna [~pie@kjal.demon.co.uk] has quit [Ping timeout: 260 seconds]
00:07 -!- nixness [~dsc@89.211.183.10] has joined #go-nuts
00:08 -!- Project-2501 [~Marvin@82.84.85.183] has quit [Quit: E se abbasso questa
leva che succ...]
00:10 -!- wtfness [~dsc@89.211.197.142] has quit [Ping timeout: 246 seconds]
00:34 -!- Nitro [~Nitro@unaffiliated/nitro] has quit [Quit: Leaving]
00:45 -!- angasule [~angasule@190.2.33.49] has quit [Ping timeout: 252 seconds]
00:47 -!- carrus85 [~carrus85@64.0.193.15] has joined #go-nuts
00:52 -!- Glasswalker [~Glasswalk@bas1-kingston08-1128729056.dsl.bell.ca] has quit
[Ping timeout: 252 seconds]
00:55 -!- carrus85 [~carrus85@64.0.193.15] has quit [Quit: Leaving]
00:59 -!- saturnfive [~saturnfiv@210.74.155.131] has joined #go-nuts
00:59 -!- venk [~user@CPE-58-160-37-24.phzl1.ken.bigpond.net.au] has quit [Quit:
ERC Version 5.3 (IRC client for Emacs)]
00:59 -!- saturnfive [~saturnfiv@210.74.155.131] has quit [Client Quit]
01:07 -!- krutcha1 [~krutcha@S010600045a27676a.vs.shawcable.net] has joined
#go-nuts
01:17 -!- wtfness [~dsc@78.100.209.217] has joined #go-nuts
01:20 -!- nixness [~dsc@89.211.183.10] has quit [Ping timeout: 248 seconds]
01:29 -!- boscop_ [~boscop@f055149081.adsl.alicedsl.de] has joined #go-nuts
01:31 -!- boscop [~boscop@f055200059.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
01:45 -!- Melvar [~melvar@dslb-092-072-156-193.pools.arcor-ip.net] has left
#go-nuts ["…"]
01:52 -!- Adys [~Adys@unaffiliated/adys] has quit [Quit: Quit]
01:57 -!- dchest [~dchest@78.155.49.42] has quit [Quit: dchest]
02:01 -!- m4dh4tt3r [~Adium@c-69-181-217-82.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
02:03 -!- Adys [~Adys@unaffiliated/adys] has joined #go-nuts
02:08 -!- crazy2be [~crazy2be@S01060012171a573b.cg.shawcable.net] has joined
#go-nuts
02:12 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
02:16 -!- nutate [~rseymour@cacsag4.usc.edu] has quit [Quit: I'm outta heee-eere]
02:19 -!- fmoo [~Adium@66.220.144.74] has quit [Quit: Leaving.]
02:40 -!- reds_ [~reds@pool-74-101-147-57.nycmny.fios.verizon.net] has quit
[Remote host closed the connection]
02:43 -!- mikespook1 [~mikespook@183.47.228.102] has joined #go-nuts
02:44 -!- mikespook1 [~mikespook@183.47.228.102] has quit [Client Quit]
02:45 -!- mikespook [~mikespook@116.21.154.192] has quit [Ping timeout: 264
seconds]
02:53 -!- keithcascio [~keithcasc@nat/google/x-uwxbyzpxtuhnpunx] has quit [Quit:
Leaving]
03:02 < plexdev> http://is.gd/4oDWGn by [Brad Fitzpatrick] in
go/src/pkg/http/ -- http: clarify docs on Request HTTP version
03:05 -!- crodjer [~rohanjain@203.110.240.205] has joined #go-nuts
03:07 -!- Garen [noway@69.76.18.3] has joined #go-nuts
03:12 -!- venk [~user@CPE-58-160-37-24.phzl1.ken.bigpond.net.au] has joined
#go-nuts
03:15 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has quit [Read error:
Connection reset by peer]
03:15 -!- viirya [~viirya@cml506-25.csie.ntu.edu.tw] has joined #go-nuts
03:15 < crazy2be> gotest is pretty cool
03:18 < Namegduf> Hmm, wow.
03:18 < Namegduf> Passing a net.Conn between processes is going to be
horrible.
03:21 < Namegduf> The only way I can see to do it is send the FD via
syscall'y tricks and then construct a netFD as a byte slice and use unsafe to turn
a pointer to a pointer to that into a *net.TCPConn
03:21 < Namegduf> Which will be both unsafe and break if Go's definition of
netFD changes at all.
03:22 < Namegduf> Be hard to do it portably, too...  blargh.
03:22 < crazy2be> don't
03:22 < crazy2be> why
03:22 < Namegduf> That's a stupid answer.
03:22 < Namegduf> Because I need to make this restartable without dropping
connections.
03:23 < crazy2be> hmm
03:23 < Namegduf> And I need to do that because there's no dynamic loading,
so it's the only way to add new code at all.
03:23 < crazy2be> one way is to have a proxy
03:23 < crazy2be> it handles the conections and maintains them if the other
process dies
03:23 < crazy2be> or something
03:23 < Namegduf> Having a central "connection owning" process is
potentially possible, but still nasty.
03:24 < crazy2be> when it gets connections it dials a different port
03:24 < crazy2be> it's ok, a bit annoying
03:24 < crazy2be> that's what i do for my web architecture
03:24 < crazy2be> although the connections don't have to persist there
03:25 < crazy2be> each section of the website is implemented as a different
process
03:25 < |Craig|> Namegduf: can you leave the old app serving existing
connections but not accepting new ones?
03:25 < crazy2be> each jailed into it's own directory
03:25 < Namegduf> |Craig|: No
03:25 < crazy2be> hrm
03:26 < Namegduf> |Craig|: The connections can communicate and both access
the same shared state
03:26 < crazy2be> how do you compare two structs?
03:26 < Namegduf> Manually.
03:26 < Namegduf> Element by element if that's what you want.
03:26 < |Craig|> Namegduf: you can have the dieing server keep the old
connections, but connect to the new server, and thus change to acting like a proxy
03:26 < Namegduf> With Go's memory usage behaviour, that would get very
nasty quickly.
03:27 -!- aho [~nya@fuld-590c675e.pool.mediaWays.net] has quit [Ping timeout: 250
seconds]
03:27 < Namegduf> The proxy would be using the RAM the server does at peak.
03:27 < Namegduf> And it'd stay doing so until the last user disconnected.
03:27 < |Craig|> how long do these connections stay active?
03:27 < Namegduf> Indefinitely.
03:28 < Namegduf> It's an IRC-compatible thing.
03:28 < Namegduf> Connections ideally stay open for months.
03:28 < crazy2be> hmm is there a better way to test if the results of a
function call returning a struct are correct?
03:28 < Namegduf> Every existing IRCD uses dynamic loading to permit new
code to be loaded in, and old code to be upgraded.
03:28 < crazy2be> other than comparing every field
03:28 < Namegduf> Go doesn't have this, so...  I need an alternative.
03:29 < Namegduf> Not being able to upgrade stuff is a killer for actual
usage.
03:29 < crazy2be> gotry?  :P
03:29 < Namegduf> Being restartable is awesome in general
03:29 < |Craig|> Namegduf: you could consider using a CGO socket wrapper
that supports some sort of passing off to the new app
03:30 < Namegduf> I'd have to write my own replacement for any and all
functionality in net I required
03:30 < Namegduf> The big hard part is the poll server.
03:30 < |Craig|> defiantly a problem I haven't had to deal with.  I don't
have any further ideas
03:30 -!- gtaylor [~gtaylor@99-5-124-9.lightspeed.gnvlsc.sbcglobal.net] has joined
#go-nuts
03:31 < Namegduf> I think I might just use unsafe and try to rig some kind
of compile-time detection of changes in Go.
03:31 < Namegduf> Maybe a miniature Go program which makes a TCPConn,
generates a fake one from its FD, and checks they match.
03:32 < Namegduf> It's nasty but alternatives are limited.
03:33 < crazy2be> what about socket -> real socket translation?
03:33 < crazy2be> and have a babysitting process that handles the
transitions
03:33 < crazy2be> the "real" deamon is monitoring the socket file
03:33 < Namegduf> If you mean the proxy idea, it's possible, and a lot more
feasible than the idea of moving the replaceable code out of process, because
that's gets called into often.
03:34 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
03:35 < |Craig|> I assume you can't send sockets over netchan, that wouldn't
make sense
03:42 < Namegduf> You can send them over UNIX domain sockets.
03:52 < tav> hmz
03:56 < crazy2be> hm
03:56 < crazy2be> is there some path.Join() function that takes n arguments
using ...string?
03:56 < crazy2be> e.g.  path.Join("blar", "foo", "foobar", "somethingelse",
...
03:57 < tav> path.Join already takes any number of path elements
03:57 * crazy2be checks again
03:57 < crazy2be> huh
03:58 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
03:58 < crazy2be> they updated that
03:58 < tav> =)
03:58 < tav> now, if only they'd magically update it so that websocket
handlers have access to the original request object (for the Headers)
03:59 * tav checks...  nope, still no update =(
03:59 < Namegduf> Blargh.
03:59 < crazy2be> WebSocket?  like the new html5 api?
03:59 < tav> crazy2be: yeah
03:59 < Namegduf> os.Open is not returning os.ENOENT for non-existent files
03:59 < Namegduf> Despite that being what the OS's open syscall returns,
according to strace
03:59 < crazy2be> Namegduf: yeah
03:59 < crazy2be> it doesn't
03:59 < Namegduf> Now I have to find a different way to check for existence.
03:59 < crazy2be> it's annoying
04:00 < crazy2be> os.Stat was suggested to me
04:00 < crazy2be> just check for any error
04:00 < crazy2be> any error stating means that it basically doesn't exist
04:00 < crazy2be> afaik
04:00 < Namegduf> Stat requires having a file.
04:00 < crazy2be> hm?
04:00 < crazy2be> check again
04:00 < tav> stat could also fail on permissions i think
04:00 < crazy2be> yeah
04:00 < Namegduf> Oh, no, there is is, under FileStat
04:01 < Namegduf> Er, FileInfo
04:01 < crazy2be> not an idea solution
04:01 < Namegduf> How unhelpful
04:01 < crazy2be> Namegduf: did they change it?
04:01 < crazy2be> used to be os.Stat()
04:01 < Namegduf> No, godoc just puts it in a weird place
04:01 < Namegduf> Because it returns a FileInfo it's listed under its stuff,
not in the main function list.
04:02 < crazy2be> ah
04:02 < Namegduf> There's also a Stat() under File, just for fun.
04:02 < crazy2be> os is a huge module is the real issue
04:02 < crazy2be> yeah
04:02 < crazy2be> lol
04:02 < Namegduf> Well, failing on bad permissions is also wrong here.
04:02 < Namegduf> Or, rather, not failing on bad permissions.
04:03 < Namegduf> If there's an error loading this file it needs to
terminate.  If the file doesn't exist, however, it needs to be created.
04:03 < Namegduf> Not a weird requirement.
04:03 < Namegduf> Nothing unusual.
04:04 < Namegduf> Why does os export those things if its own functions don't
use them, anyway?
04:04 < Namegduf> The OS is returning os.ENOENT.
04:04 < Namegduf> strace says so.
04:04 < Namegduf> If it's not returning it then, when *is* it using it?
04:05 < Namegduf> Hmm.  Odd.
04:06 < Namegduf> Looking for the answer to that question, it looks like the
tests in the os package are supposed to check it is returned for a random
non-existing file.
04:08 < Namegduf> It looks like I need to extract it from the interface,
checking it is an os.PathError, *then* compare the Error member of that.
04:09 < Namegduf> There we go.
04:10 < Namegduf> Ah, I see.  The os package is being clever and wrapping
errors in a nice bundle with the operation and path causing them, so it isn't
directly returning the same thing.
04:18 < plexdev> http://is.gd/vNS7Dy by [tav] in go/ -- Added a .gitignore
file.  -- [1 added] -- .gitignore (A)
04:19 -!- rejb [~rejb@unaffiliated/rejb] has quit [Disconnected by services]
04:19 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
04:19 < plexdev> http://is.gd/QCt5AO by [tav] in go/src/pkg/websocket/ --
Exposed original http Request as part of websocket.Conn.  -- [3 modified] --
client.go (U), server.go (U), websocket.go (U)
04:24 < crazy2be> hmm: Error initializing inotify:inotify_init: too many
open files
04:24 < crazy2be> that's a new error
04:24 -!- gtaylor [~gtaylor@99-5-124-9.lightspeed.gnvlsc.sbcglobal.net] has quit
[Quit: gtaylor]
04:27 -!- zozoR [~Morten@2906ds2-arno.0.fullrate.dk] has joined #go-nuts
04:30 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
04:31 -!- boscop_ [~boscop@f055149081.adsl.alicedsl.de] has quit [Ping timeout:
250 seconds]
04:33 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Client
Quit]
04:40 < krutcha1> given .(type), package reflect, package unsafe's
Typeof(x), what's the best way to find the underlying type that's been passed as
an empty interface?  or is that even possible?
04:40 < krutcha1> is the original type info lost?
04:42 -!- mikespook [~mikespook@183.47.228.102] has joined #go-nuts
04:44 < jessta_> krutcha1: es, the type information is available at runtime
04:48 < zozoR> i wish C# had defer :(
04:51 -!- fabled [~fabled@83.145.235.194] has quit [Read error: Operation timed
out]
04:54 -!- photron_ [~photron@port-92-201-40-159.dynamic.qsc.de] has joined
#go-nuts
04:55 < Boney> hurr.
05:00 -!- fabled [~fabled@83.145.235.194] has joined #go-nuts
05:03 -!- venk [~user@CPE-58-160-37-24.phzl1.ken.bigpond.net.au] has quit [Quit:
ERC Version 5.3 (IRC client for Emacs)]
05:03 -!- gaxxx [~woo@219.143.166.16] has quit [Ping timeout: 240 seconds]
05:06 -!- B0rder [~B0rder@114.246.90.100] has joined #go-nuts
05:07 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
05:09 -!- ExtraSpice [XtraSpice@88.118.35.153] has joined #go-nuts
05:17 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has joined #go-nuts
05:17 -!- unofficialmvp [~dev@94-62-164-227.b.ipv4ilink.net] has left #go-nuts []
05:19 < jessta_> zozoR: doesn't c# have something similiar
05:21 -!- angasule [~angasule@190.2.33.49] has joined #go-nuts
05:21 -!- angasule [~angasule@190.2.33.49] has quit [Remote host closed the
connection]
05:24 -!- m4dh4tt3r [~Adium@237.sub-75-210-170.myvzw.com] has joined #go-nuts
05:31 -!- bXi [bluepunk@irssi.co.uk] has quit [Read error: Operation timed out]
05:33 -!- bXi [bluepunk@irssi.co.uk] has joined #go-nuts
05:33 -!- iant [~iant@216.239.45.130] has quit [Ping timeout: 260 seconds]
05:34 < zozoR> jessta_, never heard of it atleast : |
05:35 < plexdev> http://is.gd/m3Iiuh by [Alex Brainman] in 2 subdirs of
go/src/pkg/ -- os: Open with O_APPEND|O_CREATE to append to the end of file on
Windows
05:47 -!- B0rder [~B0rder@114.246.90.100] has quit [Ping timeout: 240 seconds]
05:51 < uriel> "/win19
05:51 < uriel> what, like a billion GWT presentations at Google IO, and just
one Go talk?  this is depressing
05:52 < uriel> who do we need to bitch at Google to get a damned clue and
stop pusshing insane crap and start pushing more sane stuff?
05:52 < uriel> also, why can't we at least get a Fireside Chat with the Go
team?
05:52 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
05:52 -!- mode/#go-nuts [+v iant] by ChanServ
05:53 < Namegduf> krutcha1: .(type) is how you find out if it's a particular
given type.
05:53 -!- boscop [~boscop@f055169132.adsl.alicedsl.de] has joined #go-nuts
05:54 < yebyen> you can do that on a interface{} before casting, yea?
05:54 < Namegduf> "before casting?
05:54 < Namegduf> You do not cast interfaces.
05:55 < Namegduf> It is a type assertion.  It returns you the type inside
the interface, plus an ok value for whether it was the right type.
05:55 < yebyen> i'm mega out of practice with go
05:55 < yebyen> i come from the php world
05:56 < krutcha1> Namegduf: yeah that's seeming to work ok..  limited to
switch's, it allowed me to simplify my data types a fair bit, although I still
have to wrap the interface Value in a struct to have a valid receiver type for
operations
05:57 < Namegduf> Yeah, you'll have to do that.
05:57 < Namegduf> Any reason you can't just use functions, though?
05:57 < Namegduf> Not everything *has* to be a method.
05:58 < krutcha1> so I have a lot of _val := mymap["thing"]; val :=
_val.Value.(type) going on right now
05:58 -!- werdan7 [~w7@freenode/staff/wikimedia.werdan7] has quit [Ping timeout:
615 seconds]
05:58 < Namegduf> Drop the wrapper struct, use functions instead of its
methods
05:59 < Namegduf> I'm pretty sure there's no cases where that'd break for
something containing only the interface value.
05:59 < Namegduf> In general, if something is
implementation-of-interface-specific you can put it in a method and if it isn't
you can put it in a function taking the interface.
05:59 < krutcha1> yeah that's a good point, I've been chipping away at the
big struct full of type info and tore it down to a simple interface
05:59 < krutcha1> now there's really not much reason to have it as a method
anymore
05:59 -!- boscop [~boscop@f055169132.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
05:59 < krutcha1> it's got no internals to check
06:00 < krutcha1> it used to have a type enum as well, which it would switch
on internally on many operations
06:00 < krutcha1> etc..
06:00 < krutcha1> gutting kruft
06:00 < Namegduf> Makes sense.
06:00 < Namegduf> Good to simplify.
06:02 -!- werdan7 [~w7@freenode/staff/wikimedia.werdan7] has joined #go-nuts
06:12 -!- boscop [~boscop@f055169132.adsl.alicedsl.de] has joined #go-nuts
06:14 -!- m4dh4tt3r [~Adium@237.sub-75-210-170.myvzw.com] has quit [Ping timeout:
276 seconds]
06:15 -!- m4dh4tt3r [~Adium@237.sub-75-210-170.myvzw.com] has joined #go-nuts
06:15 -!- boscop [~boscop@f055169132.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
06:17 -!- stesch [~stesch@unaffiliated/stesch] has joined #go-nuts
06:20 -!- stesch [~stesch@unaffiliated/stesch] has quit [Client Quit]
06:25 -!- jnz` [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has joined #go-nuts
06:26 -!- Guest38352 [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has left #go-nuts
[]
06:28 -!- jnle [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has joined #go-nuts
06:34 -!- crazy2be [~crazy2be@S01060012171a573b.cg.shawcable.net] has quit [Ping
timeout: 260 seconds]
06:35 -!- B0rder [~B0rder@114.246.90.100] has joined #go-nuts
06:35 -!- boscop [~boscop@f055216025.adsl.alicedsl.de] has joined #go-nuts
06:39 -!- jnle [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has quit [Ping timeout:
260 seconds]
06:40 -!- kr [~Keith@c-24-5-193-165.hsd1.ca.comcast.net] has quit [Quit: WeeChat
0.3.2]
06:43 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
06:45 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
06:49 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has joined #go-nuts
06:51 -!- jnle [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has joined #go-nuts
06:54 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has joined
#go-nuts
06:55 -!- fmoo1 [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
06:55 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Read error:
Connection reset by peer]
06:56 -!- damikin11 [~damikin11@cpe-24-30-179-173.socal.res.rr.com] has joined
#go-nuts
06:57 -!- fmoo1 [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Client
Quit]
06:57 < boomtopper> Hi what's the best way of removing duplicates in an
array of strings or from a StringVector?
06:58 < |Craig|> boomtopper: I'd be tempted to just run it through a map
06:58 < boomtopper> Does map makes sure they are only unique elements?
06:58 < edsrzf> If it doesn't have to too fast, then yeah, run it through a
map.
06:58 < Namegduf> Yes.
06:58 < boomtopper> Thanks i'll do tha
06:58 < boomtopper> t
06:58 < Namegduf> Running it through a map is simple and lazy.
06:58 < Namegduf> Another option is to sort it.
06:59 < Namegduf> If it's already sorted then just copy it to a new array of
the same size, but skip elements that match the previous element.
06:59 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has joined #go-nuts
07:00 < |Craig|> you can do an inplace removal of duplicates from a sorted
array pretty easy too
07:00 < Namegduf> Without copying the rest of the array down?
07:01 < Namegduf> You can't delete-by-breaking-sorting without compromising
the sortedness
07:01 < |Craig|> you can do it by iterating over the array once and moving
all the items once
07:01 < Namegduf> How?
07:01 < |Craig|> same as making a copy with duplicates removed, except
writing the the origional array
07:01 < Namegduf> Ah, yeah.
07:01 < |Craig|> the write point is alwayse before the read point, so it
does not cause harm
07:01 < Namegduf> Yeah.
07:02 < damikin11> Hello, i was trying to use container/list, but I am
running into the issue with using Value.  I want to use int's with it, but i have
no idea how to use it.  Tried looking at interfaces in the tutorial and through
the specification, now I am completely lost.
07:03 -!- |Craig| [~|Craig|@panda3d/entropy] has quit [Quit: |Craig|]
07:04 < damikin11> If you need I can post the problem function or the whole
source, it's a prime number generator that uses a list of previous prime numbers
to see if i have a new prime number
07:04 < Namegduf> You should probably use a slice and append()
07:05 < damikin11> Where can i look up using append()?  sorry, I have not
used slices before.
07:05 -!- sebastianskejoe [~sebastian@0x57317588.vgnxx9.dynamic.dsl.tele.dk] has
joined #go-nuts
07:05 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
07:06 < damikin11> Ah, found it, thank you
07:06 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has joined #go-nuts
07:09 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Client
Quit]
07:12 -!- m4dh4tt3r [~Adium@237.sub-75-210-170.myvzw.com] has quit [Ping timeout:
260 seconds]
07:13 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
07:14 < damikin11> Namegduf: It worked wonderfully, thanks again!
07:14 < Namegduf> Great.
07:17 -!- firwen [~firwen@ANancy-554-1-46-232.w90-40.abo.wanadoo.fr] has joined
#go-nuts
07:19 -!- firwen [~firwen@ANancy-554-1-46-232.w90-40.abo.wanadoo.fr] has quit
[Remote host closed the connection]
07:21 -!- piranha [~piranha@D57D1AB3.static.ziggozakelijk.nl] has joined #go-nuts
07:34 -!- gaxxx [~woo@219.143.166.16] has quit [Ping timeout: 248 seconds]
07:37 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
07:41 -!- sebastianskejoe [~sebastian@0x57317588.vgnxx9.dynamic.dsl.tele.dk] has
quit [Quit: Lost terminal]
07:44 -!- nixness [~dsc@89.211.131.59] has joined #go-nuts
07:47 -!- gaxxx [~woo@219.143.166.16] has joined #go-nuts
07:47 -!- wtfness [~dsc@78.100.209.217] has quit [Ping timeout: 260 seconds]
07:48 -!- napsy [~luka@88.200.96.18] has quit [Ping timeout: 276 seconds]
08:02 -!- Project_2501 [~Marvin@82.84.71.179] has joined #go-nuts
08:07 -!- firwen [~firwen@90.40.229.232] has joined #go-nuts
08:19 -!- firwen [~firwen@90.40.229.232] has quit [Ping timeout: 260 seconds]
08:19 -!- jnle [~jnz@c-98-207-157-93.hsd1.ca.comcast.net] has quit [Quit: leaving]
08:24 -!- wrtp [~rog@92.17.70.99] has joined #go-nuts
08:29 < kevlar> Is there an optimized way to duplicate a struct?
08:29 < kevlar> er, slice*
08:29 < kevlar> or is a for loop the same as copy?
08:30 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
08:32 < jessta_> kevlar: copy() is your best option
08:35 -!- huin [~huin@91.84.99.134] has joined #go-nuts
08:38 < wrtp> kevlar: what jessta_ says.  copy is faster - it can just use
memmove
08:42 -!- crodjer [~rohanjain@203.110.240.205] has quit [Remote host closed the
connection]
08:47 -!- nixness [~dsc@89.211.131.59] has quit [Ping timeout: 260 seconds]
09:03 -!- arun_ [~arun@unaffiliated/sindian] has quit [Ping timeout: 250 seconds]
09:05 -!- B0rder [~B0rder@114.246.90.100] has quit [Quit: 离开]
09:07 -!- crodjer [~rohanjain@203.110.240.205] has joined #go-nuts
09:07 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
09:14 -!- fmoo [~Adium@c-76-102-41-101.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
09:15 -!- foocraft [~dsc@178.152.67.40] has joined #go-nuts
09:15 -!- zozoR [~Morten@2906ds2-arno.0.fullrate.dk] has quit [Remote host closed
the connection]
09:23 -!- dchest [~dchest@78.155.49.42] has joined #go-nuts
09:26 -!- huin [~huin@91.84.99.134] has quit [Quit: leaving]
09:28 -!- mikespook [~mikespook@183.47.228.102] has quit [Quit: Leaving.]
09:51 < boomtopper> Is it possible using 6g and 6l to build a shared library
that a c program can link too?
09:51 < aiju> no
09:51 < boomtopper> kk thanks
09:51 < aiju> 6g/6l have no shared library support whatsoever
09:52 < boomtopper> is it possible with gccgo?
09:52 < Namegduf> No
09:53 < Namegduf> Go can call into C and C can call back, but the entry
point must be in Go.
09:55 -!- TheMue [~TheMue@p5DDF650A.dip.t-dialin.net] has joined #go-nuts
10:01 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
10:03 -!- tvw [~tv@e176003079.adsl.alicedsl.de] has joined #go-nuts
10:04 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Ping
timeout: 260 seconds]
10:15 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-174-18.clienti.tiscali.it] has
joined #go-nuts
10:18 -!- Project_2501 [~Marvin@82.84.71.179] has quit [Ping timeout: 260 seconds]
10:25 -!- tvw [~tv@e176003079.adsl.alicedsl.de] has quit [Remote host closed the
connection]
10:25 -!- tvw [~tv@e176003079.adsl.alicedsl.de] has joined #go-nuts
10:33 < rm445> ISTM that a library file contains everything you need to make
a shared library, so it's possible but you'd have to write a tool to do it.
10:35 < ww> the go runtime still needs initialised, the gc run, etc
10:36 < ww> in principle you could make a shared library but it wouldn't
work (or probably even link) without a bunch of initialisation and help from the C
main
10:36 < rm445> good points
10:44 < jessta_> boomtopper: just curious, why do you want to link to Go
code from C?
10:50 < boomtopper> jessta_: I was thinking of making a deadbeef plugin
using go but it's not possible
10:52 < mpl> is doc/go_spec.html generated from some other source, or can I
directly edit that one to propose a change on it?
10:52 -!- katakuna [pie@kjal.demon.co.uk] has joined #go-nuts
10:56 -!- Scorchin [~Scorchin@host109-158-115-56.range109-158.btcentralplus.com]
has joined #go-nuts
10:57 -!- TheMue [~TheMue@p5DDF650A.dip.t-dialin.net] has quit [Quit: TheMue]
10:58 < jessta_> boomtopper: you could create a c plugin that launched a go
process a communicated with it over a socket/pipe
11:04 -!- nixness [~dsc@86.36.49.200] has joined #go-nuts
11:41 -!- gaxxx [~woo@219.143.166.16] has quit [Quit: Leaving.]
11:44 -!- Fish- [~Fish@213.41.240.142] has quit [Quit: So Long, and Thanks for All
the Fish]
11:44 -!- Fish [~Fish@exo3753.pck.nerim.net] has joined #go-nuts
11:48 -!- nixness [~dsc@86.36.49.200] has quit [Quit: Leaving]
11:50 -!- huin [~huin@91.84.99.134] has joined #go-nuts
12:14 -!- nixness [~dsc@86.36.49.200] has joined #go-nuts
12:19 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has quit [Remote
host closed the connection]
12:24 -!- firwen [~firwen@ANancy-554-1-46-232.w90-40.abo.wanadoo.fr] has joined
#go-nuts
12:31 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Ping
timeout: 252 seconds]
12:36 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has joined
#go-nuts
12:38 -!- wrtp [~rog@92.17.70.99] has quit [Quit: wrtp]
12:38 -!- TheMue [~TheMue@p5DDF650A.dip.t-dialin.net] has joined #go-nuts
12:47 -!- GeertJohan [~geertjoha@s51478c91.adsl.wanadoo.nl] has quit [Quit:
Leaving.]
12:53 -!- dahankzter [~henrik@92-244-3-192.customers.ownit.se] has quit [Quit:
Leaving.]
12:55 < prasmussen> can i somehow assign a []string to a []Entry, where
Entry is of type string?
12:55 < prasmussen> http://goo.gl/9LNnJ
12:56 < exch> prasmussen: nope.  you will have to create the new slice and
fill it manually
12:57 < prasmussen> ok, thanks
12:58 -!- firwen [~firwen@ANancy-554-1-46-232.w90-40.abo.wanadoo.fr] has quit
[Ping timeout: 264 seconds]
13:04 -!- Project_2501 [~Marvin@82.84.64.38] has joined #go-nuts
13:07 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-174-18.clienti.tiscali.it] has
quit [Ping timeout: 252 seconds]
13:08 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has quit [Quit:
Leaving.]
13:10 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
13:15 -!- dchest [~dchest@78.155.49.42] has quit [Quit: dchest]
13:18 -!- napsy [~luka@88.200.96.18] has quit [Remote host closed the connection]
13:42 -!- iant [~iant@67.218.109.241] has joined #go-nuts
13:42 -!- mode/#go-nuts [+v iant] by ChanServ
13:44 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
13:59 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
14:00 -!- cenuij [~cenuij@93.26.129.106] has joined #go-nuts
14:00 -!- cenuij [~cenuij@93.26.129.106] has quit [Changing host]
14:00 -!- cenuij [~cenuij@base/student/cenuij] has joined #go-nuts
14:00 -!- imsplitbit [~imsplitbi@64.39.4.132] has joined #go-nuts
14:03 -!- JusticeFries [~JusticeFr@66.210.206.32] has joined #go-nuts
14:09 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
14:30 -!- nixness [~dsc@86.36.49.200] has quit [Quit: Leaving]
14:32 -!- hopso [3e4ed8ee@gateway/web/freenode/ip.62.78.216.238] has joined
#go-nuts
14:37 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
14:45 -!- boscop [~boscop@f055216025.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
14:46 -!- Venom_X [~pjacobs@66.54.185.133] has joined #go-nuts
14:46 -!- meanburrito920 [~john@192.5.109.34] has joined #go-nuts
14:46 -!- meanburrito920 [~john@192.5.109.34] has quit [Changing host]
14:46 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has joined #go-nuts
14:53 -!- iant [~iant@67.218.109.241] has quit [Quit: Leaving.]
14:54 -!- boscop [~boscop@f055216025.adsl.alicedsl.de] has joined #go-nuts
14:59 -!- boscop [~boscop@f055216025.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
15:00 -!- boscop [~boscop@g226242098.adsl.alicedsl.de] has joined #go-nuts
15:03 -!- iant [~iant@nat/google/x-fmxefvsvtbfzxvsq] has joined #go-nuts
15:04 -!- mode/#go-nuts [+v iant] by ChanServ
15:05 -!- preflex [~preflex@unaffiliated/mauke/bot/preflex] has joined #go-nuts
15:17 -!- boscop [~boscop@g226242098.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
15:20 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has quit [Ping
timeout: 260 seconds]
15:21 -!- dchest [~dchest@78.155.49.42] has joined #go-nuts
15:26 -!- piranha [~piranha@D57D1AB3.static.ziggozakelijk.nl] has quit [Quit:
Computer has gone to sleep.]
15:27 -!- TheMue [~TheMue@p5DDF650A.dip.t-dialin.net] has quit [Quit: TheMue]
15:28 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
15:35 -!- dfr|mac [~dfr|work@nat/google/x-ktqbbcptbpxfmcyk] has joined #go-nuts
15:35 -!- dfr|mac [~dfr|work@nat/google/x-ktqbbcptbpxfmcyk] has quit [Remote host
closed the connection]
15:35 -!- dfr|mac [~dfr|work@nat/google/x-raysgzpnlqfbgcjq] has joined #go-nuts
15:35 -!- DeedleFake [~Deedles@c-98-251-36-162.hsd1.ga.comcast.net] has joined
#go-nuts
15:38 < DeedleFake> Hi. I'm having a problem with the reflect package.  I'm
trying to call a method using reflect; one of the arguments requires an interface
type, but when I call reflect.NewValue() on the interface variable I'm trying to
pass to it, it gives me a value who's type is the underlying type, which Call()
then incorrectly determines is the wrong type and panics.
15:44 <+iant> DeedleFake: I think you need to use reflect.Zero with the
interface type, and then Set the value
15:44 <+iant> at least, that is how it works with the new reflect package
which just went in
15:45 < DeedleFake> O.K.  I'll give that a try.
15:48 -!- willdye [~willdye@198.183.6.23] has left #go-nuts []
15:50 < DeedleFake> Slight problem.  How do I get the reflect.Type to pass
to reflect.Zero()?
15:50 -!- tvw [~tv@e176003079.adsl.alicedsl.de] has quit [Remote host closed the
connection]
15:51 < DeedleFake> Typeof doesn't work because it requires an instance of
something to be passed to it.  You can't make a blank instance of an interface
type, can you?
15:51 <+iant> hmmm.  try building a struct with a field of the interface and
asking for the type of the field
15:51 <+iant> biaw
15:53 < DeedleFake> Why not just have the reflect package check if the type
required is an interface and, if it is, check if the Type implements that
interface, rather than if it actually is the same type...
15:56 -!- exch [~exch@31-151-123-254.dynamic.upc.nl] has quit [Quit: leaving]
15:56 -!- SmoothPorcupine [~smooth@207.224.112.146] has joined #go-nuts
15:56 < SmoothPorcupine> Is the "purpose" of Go defined yet?
15:57 < skelterjohn> can't do var x interface{} = theOtherInterface?
15:58 < DeedleFake> skelterjohn: Good point...
15:58 < plexdev> http://is.gd/V7WG9k by [Ian Lance Taylor] in
go/src/pkg/http/cgi/ -- http/cgi: copy some PATH environment variables to child
15:58 < skelterjohn> well, it's possible that x will just now contain what
theOtherInterface contained
15:59 < skelterjohn> rather than theOtherInterface itself
15:59 < skelterjohn> in fact it's pretty likely :)
15:59 < DeedleFake> Well, I figured out another way to do it.  I'm getting
the type directly from the function using In(), creating a zero value of that, and
then setting it...
15:59 < DeedleFake> Thanks for the help.
15:59 -!- DeedleFake [~Deedles@c-98-251-36-162.hsd1.ga.comcast.net] has left
#go-nuts ["Ex-Chat"]
16:02 -!- exch [~exch@31-151-123-254.dynamic.upc.nl] has joined #go-nuts
16:05 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
16:06 < SmoothPorcupine> Man UNIX is awesome sometimes.
16:06 < SmoothPorcupine> Bleh wrong channel.
16:07 < SmoothPorcupine> sed --dont-buffer-dammit
16:07 < SmoothPorcupine> KBme, rlwrap | rc
16:08 < SmoothPorcupine> Gah I need to stop that.
16:08 < KBme> heh.
16:08 -!- cr0djer [~rohanjain@203.110.240.205] has joined #go-nuts
16:08 -!- asade [~rohanjain@203.110.240.205] has left #go-nuts []
16:10 -!- reds_ [~reds@pool-74-101-147-57.nycmny.fios.verizon.net] has joined
#go-nuts
16:12 -!- dfr|mac [~dfr|work@nat/google/x-raysgzpnlqfbgcjq] has quit [Ping
timeout: 246 seconds]
16:15 < plexdev> http://is.gd/DYF9Kc by [Brad Fitzpatrick] in
go/src/pkg/http/ -- http: fix FileServer's default text content type
16:17 < SmoothPorcupine> So the "purpose" of Go has been set to web server
or what?
16:18 < aiju> go.purpose = webserver
16:19 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
16:29 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has joined #go-nuts
16:30 -!- cco3-hampster [~conleyo@nat/google/x-jsvvorellkmfncxo] has joined
#go-nuts
16:32 < plexdev> http://is.gd/PVn0nX by [Brad Fitzpatrick] in 2 subdirs of
go/src/pkg/ -- os/user: new package to look up users
16:34 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 240 seconds]
16:44 -!- dfr|mac [~dfr|work@nat/google/x-libweooaizuawyva] has joined #go-nuts
16:46 -!- g0bl1n [~g0blin@unaffiliated/g0bl1n] has joined #go-nuts
16:46 < SmoothPorcupine> So I guess we're past the point where the syntax
would change or no?
16:47 < exch> Unknown.  The language is pretty stable, but there may be some
additions/removals at some point
16:48 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-163-29.clienti.tiscali.it] has
joined #go-nuts
16:48 -!- zanget [~zanget@hurf.durf.me] has joined #go-nuts
16:48 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
16:49 < SmoothPorcupine> I'm just wondering if we're past the plastic phase
or if Go can still improve.
16:50 < SmoothPorcupine> And if "trying new ideas" was ever part of the
original mission statement.
16:50 < SmoothPorcupine> I had always sort of assumed it was, but never
verified that.
16:51 < exch> Go doesn't really have anything new.  it's just very old ideas
brought together in a (mostly) coherent package
16:51 -!- Project_2501 [~Marvin@82.84.64.38] has quit [Ping timeout: 276 seconds]
16:51 -!- JusticeFries [~JusticeFr@66.210.206.32] has quit [Quit: JusticeFries]
16:51 < SmoothPorcupine> (In the sense the CSP, while old, is "new" in terms
of `go statements()`.)
16:52 < jnwhiteh> Go is just an occam FORK
16:52 < jnwhiteh> =)
16:53 < uriel> SmoothPorcupine: as far as I can tell, pretty much everything
in Go is open to change, as long as the change is clearly an improvement
16:53 < SmoothPorcupine> It has to be clear?  :(
16:53 -!- Zert [~zert@2001:470:1f15:13b2:219:66ff:feb9:ecbc] has joined #go-nuts
16:53 < Zert> hello
16:54 < uriel> but I think it is past the 'lets try random stuff and see if
it works'
16:54 < Zert> i wrote simple log parser on Golang.  when i compiled it with
gccgo it slower ~10 times when i compiled it with 6g
16:54 < Zert> is this behaviour correct?
16:54 < jnwhiteh> if you used goroutines, probably.
16:55 < jnwhiteh> goroutines in gccgo are threads
16:55 < Zert> no, there is no goroutines
16:55 < Zert> just one thread, read file, parse lines, create structures
16:55 < SmoothPorcupine> What I have in mind would obsolete `go
statements()`, and just overall change the face of Go.
16:55 < jnwhiteh> SmoothPorcupine: stop talking around the issue and say
what you want to say =)
16:56 < jnwhiteh> there is no magical 'state of Go' that can guide you, and
you can continue to contribute new ideas
16:56 -!- bortzmeyer [~stephane@2a01:e35:8bd9:8bb0:60a5:7c86:24e6:6cef] has joined
#go-nuts
16:56 < jnwhiteh> this is a good forum for doing this
16:56 < SmoothPorcupine> jnwhiteh, I'm not good at straightforward.
16:56 < jnwhiteh> I'm not good at being lead around a bush =)
16:56 < SmoothPorcupine> Also there are a bunch of people here.
16:56 < jnwhiteh> its not fun or productive =)
16:56 < jnwhiteh> so?
16:56 < jnwhiteh> that's a better thing, no?
16:57 < SmoothPorcupine> And "people" have never been one for being open
minded.  :V
16:57 < jnwhiteh> Either you propose it here, on golang-nuts or golang.dev
16:57 < jnwhiteh> you can't get around proposing it to people
16:57 < SmoothPorcupine> Yeah I know mailing lists are wrose which is why
I'm here.
16:57 < SmoothPorcupine> worse*
16:57 < jnwhiteh> so say what you want to say =)
16:58 < SmoothPorcupine> Also this might obsolete channels.  Not sure
though.
16:58 < jnwhiteh> so ..  just..  say it =
16:58 < exch> If you have an idea, just propose it.  If people don't like
it, they'll tell you.
16:58 < SmoothPorcupine> My idea is multiple returns.
16:59 < jnwhiteh> as in multiple return values from function calls?
16:59 < SmoothPorcupine> exch, but the default state of an idea is to not
like it.
16:59 < SmoothPorcupine> jnwhiteh, no.
16:59 < jnwhiteh> SmoothPorcupine: that isn't going to change no matter how
long you talk 'around' the issue
16:59 < exch> SmoothPorcupine: true.  that's why you have to make an effort
to change people's minds
16:59 < jnwhiteh> and saying all of these statements against the idea you
haven't presented isn't helping.
17:00 < jnwhiteh> I have an incredibly open mind, and I"m happy to be very
honest with you and talk through an idea
17:00 < SmoothPorcupine> The idea is like go statements.
17:00 < SmoothPorcupine> Only instead of callinga function, you return to
the caller.
17:00 < jnwhiteh> okay, what are the semantics of these 'go-like
statements'?
17:00 < exch> func ?nth ( n seq -- elt/f ) [ 2dup bounds-check?  [
nth-unsafe ] [ 2drop false ] if ]
17:00 < exch> eep
17:01 < SmoothPorcupine> And you can return to the caller multiple times.
17:01 < yebyen> is that factor?
17:01 < exch> yebyen: more or less
17:01 < aiju> no, C++
17:01 < exch> it's my Go/Factor hybrid
17:01 < yebyen> kitten?
17:01 < exch> ya
17:01 < jnwhiteh> SmoothPorcupine: so they're coroutines and yields?
17:02 < SmoothPorcupine> I guess for the purposes of describing what I am ,
you coul dlook at it that way, but I don't really see it like that.
17:02 < SmoothPorcupine> am,*
17:02 < SmoothPorcupine> could look*
17:03 < jnwhiteh> where's the concurrency?
17:03 < yebyen> exch: when i looked at that, i turned away because the
website said you didn't have closure semantics yet...
17:03 < exch> yebyen: indeed
17:04 -!- Glasswalker [~Glasswalk@67.71.9.224] has joined #go-nuts
17:04 -!- nixness [~dsc@86.36.49.200] has joined #go-nuts
17:04 < exch> there are a lot of things it doesnt have yet
17:04 < SmoothPorcupine> The way I'm looking at it, a "goroutine" starts
whenever a function decides to return to the caller, instead of just, you know,
terminating execution.
17:04 < jnwhiteh> do you have any pseudo-code to explain what you would like
to see and what the semantics of it are?
17:04 < SmoothPorcupine> Which is what you get on } regardless.
17:05 < jnwhiteh> that would be very useful
17:05 < jnwhiteh> } doesn't terminate execution..
17:05 < jnwhiteh> its a syntactic construct only
17:05 < jnwhiteh> its a block delimiter
17:05 < SmoothPorcupine> Yes, currently, return terminates execution of a
function as well.
17:06 < jnwhiteh> well saying } does that is not correct.  Its the implicit
return at the end of a function that has no return value that is doing that =)
17:06 < SmoothPorcupine> Yes, that is what I mean.  The block terminates.
There is no more code to run so it stops taking scheduler time and memory.
17:06 < jnwhiteh> yes, but an if block does not have the same properties
17:06 < jnwhiteh> if foo { }
17:06 < jnwhiteh> that doesn't 'return to caller', its just a block
delimiter
17:06 < jnwhiteh> but I'll stop being nit-picky..  i'm just trying to
understand...
17:07 < SmoothPorcupine> But suppose you stop thinking about returns like
you do, and think of it in terms of my idea: There is no implicit return.
17:07 -!- cco3-hampster [~conleyo@nat/google/x-jsvvorellkmfncxo] has quit [Quit:
Leaving.]
17:07 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
17:07 < SmoothPorcupine> For example: func exit(){}
17:07 -!- cco3 [~conleyo@nat/google/x-lgcxtognwmanmcxz] has joined #go-nuts
17:07 < SmoothPorcupine> Not returning, it halts.
17:07 < jnwhiteh> so is that a continuation that ignores its input?
17:08 < SmoothPorcupine> "Continuation"?
17:08 < jnwhiteh> if we take concurrency out of it entirely for a moment,
what does a normal recursive function, say fibonacci look like?  how does it
function?
17:08 < jnwhiteh> if you don't know what continuations are, just ignore
that..  it just helps put things into perspective for me
17:09 < SmoothPorcupine> Recursive functions are normal?  ;)
17:09 < jnwhiteh> incredibly
17:10 -!- dfr|mac [~dfr|work@nat/google/x-libweooaizuawyva] has quit [Ping
timeout: 276 seconds]
17:10 < SmoothPorcupine> What would a call to fibonacci look like?
17:10 < jnwhiteh> I'm asking you =)
17:10 < jnwhiteh> fib(3)
17:10 < jnwhiteh> computes the third fibonacci number by invoking fib()
17:10 < SmoothPorcupine> Ah...
17:11 < SmoothPorcupine> Well why wouldn't you do that via iteration...?
17:11 < jnwhiteh> 1.  the fibonacci sequence is defined by a recursive
function in maths
17:11 < jnwhiteh> 2.  its a natural way of programming for many people
17:12 < SmoothPorcupine> Yeah, but look at the algorithm for extracting a
single number for that series.
17:13 < jnwhiteh> I don't follow..
17:13 -!- Venom_X [~pjacobs@66.54.185.133] has quit [Quit: Venom_X]
17:14 < SmoothPorcupine> a,b = 0,1;index.times{a,b = b,a + b};return b;
17:15 < aiju> 19:14 < SmoothPorcupine> Well why wouldn't you do that
via iteration...?
17:15 < aiju> minimum coolness requirements
17:15 -!- boscop [~boscop@g225227098.adsl.alicedsl.de] has joined #go-nuts
17:15 -!- boscop [~boscop@g225227098.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
17:16 < SmoothPorcupine> I dunno, I'm prepared to drop recursion even before
I thought of this idea.
17:17 < SmoothPorcupine> But to answer your question, it would work like
regular recursion.
17:17 < aiju> i prefer iterative algorithms because they are faster and
don't fuck up my stack dumps
17:17 < SmoothPorcupine> if conf {return val1}else{return val2}
17:18 < SmoothPorcupine> aiju, I prefer iteration because it's easier to
read.
17:18 < SmoothPorcupine> cond*
17:18 < aiju> SmoothPorcupine: depends on the problem
17:19 < SmoothPorcupine> Now, in a world where return doesn't terminate the
execution of the function, we can't do if conf {return val1} /* implied else */
return val2
17:19 < SmoothPorcupine> cond**
17:20 -!- Project-2501 [~Marvin@dynamic-adsl-94-36-163-29.clienti.tiscali.it] has
quit [Read error: Connection reset by peer]
17:20 -!- JusticeFries [~JusticeFr@157.sub-75-240-9.myvzw.com] has joined #go-nuts
17:20 < SmoothPorcupine> Because then, if cond, the function returns twice,
once with val1 and once with val2.
17:21 < SmoothPorcupine> func light_fork(){return;return}
17:23 < SmoothPorcupine> jnwhiteh, still there or are you allergic to Ruby?
;P
17:23 -!- boscop [~boscop@g225227098.adsl.alicedsl.de] has joined #go-nuts
17:25 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
17:26 < SmoothPorcupine> Also, if /any/ language /anywhere/ has even
implemented this, I don't know about it and would like to.
17:26 < SmoothPorcupine> ever*
17:28 -!- damikin11 [~damikin11@cpe-24-30-179-173.socal.res.rr.com] has quit [Ping
timeout: 240 seconds]
17:31 -!- Fish- [~Fish@9fans.fr] has joined #go-nuts
17:32 -!- sjbrown [~sjbrown@adsl-99-189-162-6.dsl.pltn13.sbcglobal.net] has joined
#go-nuts
17:35 -!- n____ [~alouca@gw-r.lan.mple.org] has joined #go-nuts
17:35 < jnwhiteh> SmoothPorcupine: sorry, had to shower.
17:36 < jnwhiteh> SmoothPorcupine: I just don't see how this is an
improvement over pretty much anything
17:37 < jnwhiteh> perhaps a more coherent presentation of the concept would
be useful
17:37 < jnwhiteh> aiju: I prefer iterative algorithms as well, but recursion
certainly has a place :P
17:38 -!- nixness [~dsc@86.36.49.200] has quit [Quit: Leaving]
17:39 < KBme> <SmoothPorcupine> Because then, if cond, the function
returns twice,
17:39 < KBme> what the *%$#?
17:39 < jnwhiteh> KBme: I'm not even sure what he's saying, to be completely
honest
17:39 < jnwhiteh> that why I keep asking questions, to put things into
context
17:39 <+iant> Zert: with gccgo, did you compile with optimization?  i.e.,
use -O?
17:39 <+iant> returning twice sounds like a continuation to me
17:40 < KBme> i don't know of any language where a function can return twice
17:40 < jnwhiteh> iant: coroutines and yields and well, possibly
17:41 < jnwhiteh> iant: that's what I'm trying to understand =)
17:41 <+iant> KBme: look at Scheme and call-with-current-continuation
17:41 <+iant> it's not really returning twice, but it is not entirely
different either
17:42 -!- cenuij [~cenuij@base/student/cenuij] has quit [Remote host closed the
connection]
17:42 < jnwhiteh> indeed, continuations are a good time.
17:43 < SmoothPorcupine> What's a continuation?
17:44 <+iant> SmoothPorcupine: http://en.wikipedia.org/wiki/Continuation
17:46 -!- fabled [~fabled@83.145.235.194] has quit [Ping timeout: 252 seconds]
17:47 -!- n____ [~alouca@gw-r.lan.mple.org] has quit [Quit: n____]
17:49 < ww> another flavour of reification...
17:49 < SmoothPorcupine> Do you mean first-class continuations?
17:49 -!- boscop_ [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
17:49 <+iant> yes
17:50 < SmoothPorcupine> The more I think about it, the more I suspect
first-class things are a necessary response to an incomplete language.
17:50 < aiju> hahaha
17:51 < SmoothPorcupine> In this case, the "continuation" would not be
first-class.
17:51 <+iant> we should design a language in which everything is
second-class
17:51 < aiju> brainfuck ;P
17:51 < aiju> we should design a class-less language
17:51 -!- boscop [~boscop@g225227098.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
17:51 < aiju> called Marx++
17:51 -!- cco3 [~conleyo@nat/google/x-lgcxtognwmanmcxz] has quit [Quit: Leaving.]
17:52 -!- hopso [3e4ed8ee@gateway/web/freenode/ip.62.78.216.238] has quit [Ping
timeout: 252 seconds]
17:54 < SmoothPorcupine> I still refuse to learn lisp to read those
examples, but I've used a function called callcc in Ruby at least.
17:54 <+iant> lisp is one of the easiest languages to learn
17:54 <+iant> it has no syntax
17:54 < aiju> except for the syntax
17:54 < SmoothPorcupine> So is Brainfuck.
17:55 < aiju> lisp is not just a bunch of braces
17:55 < aiju> and even those have syntax
17:55 < Soultaker> so does Brainfuck.
17:55 < Soultaker> I think PostScript is closer to a syntax-less language.
17:55 < aiju> except for the syntax
17:55 <+iant> let's just go to Forth
17:56 < Soultaker> aiju: there is no syntax, and there is no parser, after
the tokenizer.
17:56 < aiju> Soultaker: where?
17:56 < Soultaker> (though you could argue that the tokenizer uses syntax)
17:56 < aiju> there is { } in postscript
17:56 < Soultaker> and yeah, Forth is pretty similar.
17:56 < aiju> forth has : ;
17:57 < Soultaker> but those are not parsed.  you can write stuff like [ { }
}} { { }{ }{{}{}} ] and nobody cares the sentence is ungrammatical.
17:58 < aiju> in postscript?
17:58 < aiju> Error: /syntaxerror in --execute--
17:58 -!- a2800276 [~a2800276@xdsl-87-78-137-184.netcologne.de] has joined
#go-nuts
17:58 < Soultaker> yeah *in execute*
17:58 < Soultaker> hmm
17:58 < Soultaker> maybe I need to think about this.
17:59 < aiju> this seems even more pointless than the context freeness thing
17:59 < Soultaker> I was thinking { } are akin to [ ] except the resulting
list is marked executable
17:59 < Soultaker> but my postscript may be a little rusty.
18:00 < SmoothPorcupine> jnwhiteh, well I'm still unable to answer your
first question about to continuations.
18:00 < SmoothPorcupine> the relation*
18:01 -!- fmoo [~Adium@66.220.144.74] has quit [Quit: Leaving.]
18:01 -!- JusticeFries [~JusticeFr@157.sub-75-240-9.myvzw.com] has quit [Ping
timeout: 248 seconds]
18:02 -!- JusticeFries [~JusticeFr@66.210.206.32] has joined #go-nuts
18:03 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
18:03 < SmoothPorcupine> I guess you could say that when a function jumps
off to call another function, it is said to push its continuation to the stack, so
that when the called function returns, the caller continues.
18:04 < plexdev> http://is.gd/Uox8gj by [Brad Fitzpatrick] in
go/src/pkg/http/cgi/ -- http/cgi: pass some default environment variables
18:04 < SmoothPorcupine> s/Iguess you could/could you say/?
18:05 < SmoothPorcupine> I guess*
18:05 < jnwhiteh> I'm really unclear of why you *refuse* to learn a language
in order to read examples
18:05 < jnwhiteh> that just stinks of..  something to me.
18:06 < SmoothPorcupine> I just don't like bracket spam.
18:06 < aiju> heh
18:06 < aiju> i prefer LISP's bracket spam over haskell's horrible syntax
18:06 < SmoothPorcupine> Is what I said an accurate description of
continuations?
18:07 < jnwhiteh> I don't like people who aren't willing to look past syntax
to learn concepts =)
18:07 < aiju> SmoothPorcupine: continuations are a fancy way to do something
even more crazy than goto
18:07 < aiju> but it's hip and new so it's ok
18:07 -!- katakuna [pie@kjal.demon.co.uk] has quit []
18:07 < aiju> jnwhiteh: i like some of the concepts behind haskell
18:07 < jnwhiteh> continuations were hip and new 30 years ago =)
18:07 < aiju> jnwhiteh: i just don't like the syntax
18:07 < jnwhiteh> I know you've learned Haskell, that wasn't directed to you
=)
18:07 < SmoothPorcupine> jnwhiteh, I like concepts.  I don't like
((((((((((((((()))))))))))))).
18:08 < jnwhiteh> *shrug*
18:08 < jnwhiteh> I can't tell you what your have in terms of continuations
18:08 < SmoothPorcupine> Wait, did I match that right or is it unbalanaced?
18:08 < jnwhiteh> because you haven't quite told us what you have
18:09 < jnwhiteh> I asked for
18:09 < SmoothPorcupine> Leaving my idea aside, is what I said an accurate
description of the continuation concept?
18:09 < jnwhiteh> some pseudo-code and some semantics
18:09 < jnwhiteh> I don't see where you described continuations
18:09 < jnwhiteh> i see a sentence relating continuations to functions
'jumping off to call other functions'
18:09 < aiju> as i get them, you just save state
18:10 < aiju> and then you return to it
18:10 < jnwhiteh> SmoothPorcupine: you implement 'return' in continuations
18:10 < SmoothPorcupine> Yeah.  That's what a function does when you call
another function.  Yes?
18:11 < SmoothPorcupine> Moreover, if you didn't save the continuation, it
would be logically impossible to return to the caller, would it not?
18:13 < SmoothPorcupine> Insofar as 'this' is an implied parameter in OOP
languages, caller_continuation is an implied parameter that only return ever uses.
18:14 < SmoothPorcupine> Yes/No/I don't understand?
18:15 < jnwhiteh> its normally more explicit.
18:15 < jnwhiteh> and the first scheme example on the webpage makes this
quite clear
18:15 < SmoothPorcupine> Right, but I'm not talking about first-class
continuations.
18:15 < jnwhiteh> call/cc calls its first argument with an argument that
represents the calling point in the program.
18:17 < SmoothPorcupine> fork();fork();print("Hi.")
18:17 < jnwhiteh> but in that case a continuation is just an abstract
representation of the control state
18:17 < SmoothPorcupine> Easy enough to understand?
18:17 < jnwhiteh> sure?
18:18 < SmoothPorcupine> Not if you don't understand the implications of
fork.  ;)
18:18 < jnwhiteh> ...
18:18 < jnwhiteh> i'm really not interested in playing games
18:18 < jnwhiteh> i don't have the patience for it
18:18 < SmoothPorcupine> My idea is to give every function that ability.
18:18 < jnwhiteh> *what* ability?
18:18 < SmoothPorcupine> As many times as the called function returns, the
caller will "continue".
18:19 < SmoothPorcupine> As fork does.
18:19 < SmoothPorcupine> print(fork())
18:19 < SmoothPorcupine> Understandable?
18:19 < foocraft> hi
18:20 < jnwhiteh> other than not understanding your definition of 'returns'.
18:20 -!- krutcha1 [~krutcha@S010600045a27676a.vs.shawcable.net] has quit [Quit:
Leaving]
18:20 < foocraft> wut are you guys talking about?
18:20 < SmoothPorcupine> The very basic concpet of fork is what my idea is.
18:20 < SmoothPorcupine> concept*
18:20 < SmoothPorcupine> The very basic concept of fork, is that is returns
twice.
18:21 < jnwhiteh> ...
18:21 < SmoothPorcupine> As opposed to every other function in existence.
18:21 < jnwhiteh> fork returns once
18:21 < jnwhiteh> the result of runnign fork is a new thread of execution,
which can also independently return
18:21 < jnwhiteh> that's quite different from 'fork returning twice'
18:21 < SmoothPorcupine> No, it returns twice.  Once in the parent and once
in the child.
18:22 < jnwhiteh> the *call* to fork() returns *once*
18:22 < jnwhiteh> it has a side-effect
18:22 < SmoothPorcupine> This is how it was first described to me.
<_<
18:22 < jnwhiteh> if you want to view it that way, that' sfine
18:22 < jnwhiteh> but I'll continue to seek clarification
18:22 < SmoothPorcupine> Though I didn't realize the idea of multiple
returns until much more recently.
18:23 < SmoothPorcupine> func many(){fork();fork();return "Hi."}
18:23 < SmoothPorcupine> print(many())
18:23 < SmoothPorcupine> Easy enough to understand?
18:23 < jnwhiteh> no
18:24 < jnwhiteh> I don't understand what that would do
18:24 < jnwhiteh> I can guess, but I don't know.
18:25 < SmoothPorcupine> Yet you understand fork();fork();print("Hi.")?
18:25 < jnwhiteh> no, you said yourself I didn't.
18:25 < jnwhiteh> the semantics have not been clearly defined to me
18:25 < SmoothPorcupine> Only if you haven't yet learned what fork does.
18:25 < SmoothPorcupine> Which you have.
18:25 < jnwhiteh> as I said, I can guess
18:25 < jnwhiteh> but I don't know
18:26 -!- Cobi [~Cobi@2002:1828:88fb:0:aede:48ff:febe:ef03] has quit [Ping
timeout: 264 seconds]
18:28 < SmoothPorcupine> Would you know what that program would do if
implemented in C?
18:28 < jnwhiteh> it would cause "Hi." to be printed three time
18:29 < jnwhiteh> actually, no
18:29 < jnwhiteh> more than tha t=)
18:29 -!- Venom_X [~pjacobs@66.54.185.133] has joined #go-nuts
18:29 < jnwhiteh> I fully get that
18:29 -!- m4dh4tt3r [~Adium@c-69-181-217-82.hsd1.ca.comcast.net] has joined
#go-nuts
18:30 < SmoothPorcupine> Assuming fork() in Go uses the same system call,
you understand then?
18:30 < jnwhiteh> ...
18:30 < jnwhiteh> they're the same
18:31 < jnwhiteh> I have an understanding of the things you are typing, I'm
just asking for you to clearly define the things that you are changing the
definition of
18:31 < Zert> where i can read about different imlementation issues in 6g
and gccgo?
18:31 < jnwhiteh> SmoothPorcupine: what is the point you are trying to get
at?
18:31 < SmoothPorcupine> I'm changing the definition of return.
18:31 -!- kamaji [~kamaji@cpc2-aztw22-2-0-cust775.aztw.cable.virginmedia.com] has
joined #go-nuts
18:32 < jnwhiteh> so give me pseudo-code
18:32 < jnwhiteh> and then explain the semantics
18:32 < SmoothPorcupine> Ever so slightly.
18:32 < jnwhiteh> something I asked for an hour ago
18:32 < jnwhiteh> otherwise I'll be moving on
18:32 < SmoothPorcupine> func fork(){return;return}
18:32 * ww rereturns
18:33 < jnwhiteh> SmoothPorcupine: and what is the semantics of this 'fork'
function?
18:33 < jnwhiteh> s/is/are/
18:33 < SmoothPorcupine> The same as before.
18:33 < ww> it looks something like yield in python
18:34 < SmoothPorcupine> (Let's forget process/goroutine dichotomy for a
second, if possible.)
18:34 < jnwhiteh> Don't say 'the same as before'
18:34 < jnwhiteh> explain what the fork function does, and how it works
18:34 < ww> maybe it's for quantum computers?
18:35 < SmoothPorcupine> The fork function would return twice.
18:35 < ww> the function returns a superposition of states...
18:35 < SmoothPorcupine> Once to caller...  And then again to the same
continuation.
18:36 < SmoothPorcupine> The fork system call is just a dirty way of
duplicating the continuation of the calling function.
18:36 < SmoothPorcupine> By duplicating the whole process.
18:37 -!- carrus85 [~carrus85@64.0.193.15] has joined #go-nuts
18:38 < ww> so func fork() { go child(); return "hello" }
18:39 < Zert> it there some other differences in 6g and gccgo except
goroutines as threads in gccgo?
18:39 < SmoothPorcupine> Will child() ever return a value to the function
that called fork()?
18:39 < Zert> may be some details in garbage collection realization?
18:40 < ww> SmoothPorcupine: could do using a channel, but not necessarily
18:41 < ww> you could do, func fork() { ch := make(chan foo); go child(ch);
return "hello", ch }
18:41 < ww> then you get the "hello" immediately and you can read ch for
some value afterwards
18:41 < jnwhiteh> I don't see how this is better than the explicit creation
of a new thread of control
18:42 < jnwhiteh> or even why its desirable
18:42 < SmoothPorcupine> ww, you'd need to manually spawn a goroutine to
"yield" return values to a channel, and the caller would have to get values from
those channels in a loop.
18:43 -!- crazy2be [~crazy2be@S01060012171a573b.cg.shawcable.net] has joined
#go-nuts
18:43 < ww> a similar pattern is quite common, func(args...) (ch chan
something, err os.Error)
18:43 < SmoothPorcupine> jnwhiteh, that the exact kind of statement that
gives me pause to say anything at all.
18:43 < ww> and it will typically do exactly that
18:43 < jnwhiteh> SmoothPorcupine: well what do you expect?
18:43 < SmoothPorcupine> Of course you're not sure.  neither am I. Not the
issue here.
18:43 < jnwhiteh> that people are going to fawn over your poorly explained
idea?
18:43 < SmoothPorcupine> Neither*
18:44 < SmoothPorcupine> You really do have to explicitly ask for people to
have an open mind in order for them to do so.
18:44 < jnwhiteh> I said I do
18:44 < jnwhiteh> and I do.
18:44 < jnwhiteh> but I've asked very simple questions, and if you feel
you've answered them adequately, then I have failed to understand your
explanations.
18:45 < jnwhiteh> I enjoy having discussions about new ideas
18:45 < SmoothPorcupine> I do think I have.
18:45 < jnwhiteh> then we'll just have to agree to disagree
18:45 < SmoothPorcupine> You understand when I say "fork returns twice,"
right?
18:45 < jnwhiteh> I disagree with you saying that, but I understand why you
say that.
18:46 < SmoothPorcupine> Well in my visualization of return, return does not
end the function, it merely calls the caller functions continuation.
18:47 < SmoothPorcupine> So you can return as many times as you like.
18:47 < jnwhiteh> okay, but you still only have one thread of execution
18:47 < jnwhiteh> or rather, no way to distinguish between which thread of
execution you are
18:47 < jnwhiteh> so how do they ever diverge?
18:47 < jnwhiteh> (in behaviour)
18:48 < SmoothPorcupine> function fork() bool {return true;return false}
18:48 < SmoothPorcupine> func*
18:49 < SmoothPorcupine> In the examples above, divergence wasn't needed
since all we did was print().
18:50 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has quit [Read
error: Connection reset by peer]
18:50 < jnwhiteh> from my understand, in the example func foo() { fork();
return "hi" }; print(foo()) the print() function is called twice, each time with a
different argument.
18:50 -!- anticw [~anticw@c-67-169-68-180.hsd1.ca.comcast.net] has joined #go-nuts
18:50 < jnwhiteh> also, you don't need to name a function 'fork' for me to
understand that your 'returns' are forking
18:50 < jnwhiteh> if anything that makes things more confusing
18:51 < plexdev> http://is.gd/13JS04 by [Dave Cheney] in 2 subdirs of
go/src/pkg/ -- syscall: fix Ftruncate under linux/arm5
18:52 < SmoothPorcupine> Would it have help to say, "This is how you would
implement this with multiple returns."
18:52 < SmoothPorcupine> ?
18:52 < jnwhiteh> so you've created a construct that replaces explicit
creation of 'threads of execution' by changing the semantics of 'return' to
unconditionally fork a new thread.
18:53 < jnwhiteh> so where you have func foo() { return "Hi"; return "Hi" };
print(foo()) that's has the same output behaviour as fork(); print("Hi")
18:53 < jnwhiteh> What behaviour does this enable that you find useful?
18:53 < SmoothPorcupine> Yes.
18:54 < SmoothPorcupine> It embeds threads into the language.
18:54 < SmoothPorcupine> As opposed to go statements, which could simply not
be implemented.
18:54 < jnwhiteh> and forces the all to share the same address space and
memory
18:54 < jnwhiteh> and avoiding that is one of the major goals of both Go and
Rust.
18:55 < SmoothPorcupine> If you need a new address space and memory, then
you want the fork system call.
18:55 < jnwhiteh> so there's no lightweight threading
18:56 < SmoothPorcupine> (Which is why I initially called it light_fork.)
18:57 < jnwhiteh> again, a fundamental feature of Go/Rust/Erlang/occam/etc
=)
18:58 < jnwhiteh> It's an interesting concept to try on top of a language
that is stuck in the world of full threads/processes
18:58 < jnwhiteh> but I'm having difficulty understanding how I would ever
use it
18:58 < SmoothPorcupine> You could say that all other languages have
ends-with-return optimization.
18:58 < jnwhiteh> How would a function return a value without forking?
18:59 < SmoothPorcupine> Optimization.  ;)
18:59 < jnwhiteh> O.o?
18:59 < jnwhiteh> So the semantics of return are that it forks, but only if
there are multiple returns?
19:00 < jnwhiteh> at that point, wouldn't it be clearer to have two
keywords?
19:00 < SmoothPorcupine> func cat(file){print(read(file))}
19:01 < jnwhiteh> read() is the only thing that that (ostensibly) 'returns'
a value.  The others just have side-effects
19:01 < SmoothPorcupine> func read(file){/* Ugh, I'm not up to date on Go
idioms but basically you read 4096 blocks from the file and return the value each
time */}
19:02 < jnwhiteh> ah
19:02 < jnwhiteh> that doesn't do what you think it does
19:02 < jnwhiteh> you've broken sequentiality
19:02 < jnwhiteh> all 4k blocks will be printed, but not in the order you
think
19:03 -!- aruckus [~arukus@98.164.227.211] has joined #go-nuts
19:03 < SmoothPorcupine> Also they will also likely print the same block.
19:03 < aruckus> Is there a built in function for checking if something is a
member of a slice, or do you have to just go through it with a loop?
19:04 < SmoothPorcupine> Unless I'm allocating a new block for every read.
19:04 -!- fmoo [~Adium@66.220.144.74] has quit [Quit: Leaving.]
19:05 -!- fmoo [~Adium@66.220.144.74] has joined #go-nuts
19:05 < jnwhiteh> indeed
19:05 < SmoothPorcupine> So long as the return value is being used, it would
be thus unwise to continue execution after the return.
19:05 -!- Glasswalker [~Glasswalk@67.71.9.224] has quit [Ping timeout: 260
seconds]
19:05 -!- meanburrito920 [~john@192.5.109.34] has joined #go-nuts
19:05 -!- meanburrito920 [~john@192.5.109.34] has quit [Changing host]
19:05 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has joined #go-nuts
19:06 < SmoothPorcupine> But as soon as that return value is done being
used...
19:06 < jnwhiteh> but that's being done in another thread of execution
19:06 < jnwhiteh> now they have to be aware of each other
19:07 < SmoothPorcupine> If we want the blocks brinted in order, we must
have sequence.
19:07 < SmoothPorcupine> printed*
19:07 < SmoothPorcupine> If that means optimizing out a goroutine, so be it!
19:08 -!- kr [~kr@c-24-5-193-165.hsd1.ca.comcast.net] has joined #go-nuts
19:09 < jnwhiteh> So you want concurrency, but want to force sequentiality
in certain situations?
19:09 < jnwhiteh> sounds like an absolute nightmare =/
19:09 < kamaji> aruckus: member of a slice?
19:09 < kamaji> aruckus: you mean if it contains a value?
19:10 < aruckus> like is an element of?  yeah
19:10 < SmoothPorcupine> The only time yoo want sequentiality is when you're
going to use the same memory that you're returned to the caller.
19:10 < kamaji> there's the sort package, but I think you'll have to go
through it
19:10 < jnwhiteh> I disagree
19:10 < SmoothPorcupine> I'm defining.  ;)
19:10 < jnwhiteh> Assume for a second that you're doing a fresh malloc() and
free() for each of these blocks
19:10 < jnwhiteh> you still have my issue to deal with
19:11 -!- Zert [~zert@2001:470:1f15:13b2:219:66ff:feb9:ecbc] has left #go-nuts
["ERC Version 5.3 (IRC client for Emacs)"]
19:11 < SmoothPorcupine> Also, as the end of read(), after all the returns
have returned and the file is EOF, you can simply free the block.
19:11 < kamaji> aruckus: I'm not aware of any built-in function like 'elem'
19:12 < aruckus> yeah didn't think there was, but figured id check
19:12 < SmoothPorcupine> This alleviates the caller of having to free.
19:12 < SmoothPorcupine> Even for a function that returns once, it's useful.
19:13 < SmoothPorcupine> malloc(...);return ...;free(..)
19:13 < jnwhiteh> So again, what behaviour are you trying to enable here?
19:13 < SmoothPorcupine> The caller does not need to maange memory at all.
19:13 < SmoothPorcupine> manage*
19:13 < SmoothPorcupine> I'm not adding anything that can't already be done
due to turing completeness.
19:14 < SmoothPorcupine> For me to add something that cannot be done..
Would be logically impossible, would it not?
19:14 < SmoothPorcupine> I'm simply shifting things around.
19:14 < jnwhiteh> okay, but what does this make easier?
19:14 < SmoothPorcupine> Dissloving the need for go, or defer, for that
matter.
19:14 -!- gtaylor2 [~gtaylor@99-5-124-9.lightspeed.gnvlsc.sbcglobal.net] has
joined #go-nuts
19:15 -!- wrtp [~rog@92.17.70.99] has joined #go-nuts
19:15 < SmoothPorcupine> And loads of for r := range(ch) {loops}.
19:15 < jnwhiteh> it doesn't solve the need for range loops
19:15 -!- matti_ [~mumboww@c-24-6-22-101.hsd1.ca.comcast.net] has quit [Quit:
matti_]
19:15 < jnwhiteh> due to sequentiality
19:15 < jnwhiteh> which I haven't seen a solution for
19:15 < jnwhiteh> hence my confusion =)
19:16 < SmoothPorcupine> The solution is to not continue execution until the
caller is done using the memory you returned to it.
19:16 < jnwhiteh> I'd be interested in seeing some programs that you think
are easier to express in this fashion
19:16 < jnwhiteh> how do you resolve when that is the case?
19:16 < SmoothPorcupine> Once the caller is done with that memory, you can
go about your business like nothing happened.
19:16 < jnwhiteh> and still have some semblence of concurrency?
19:17 < SmoothPorcupine> Not every return needs concurrency.
19:17 < SmoothPorcupine> Remember the world we came from?  ;)
19:17 < jnwhiteh> yet its how you provide it?
19:17 < jnwhiteh> I don't know what world you came from
19:17 < jnwhiteh> mine is one rife with concurrency
19:18 < SmoothPorcupine> You know, the old world, there return was the last
thing you'd ever do.
19:18 < jnwhiteh> ...
19:18 < SmoothPorcupine> Instead of being an abstract and nebulous return to
this "caller continuation."
19:19 < jnwhiteh> I stand by what I said.
19:19 < jnwhiteh> I would be interested in seeing some programs that you
think are easier to express in this fashion.
19:19 -!- kr [~kr@c-24-5-193-165.hsd1.ca.comcast.net] has quit [Ping timeout: 252
seconds]
19:19 -!- hopso [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has joined
#go-nuts
19:19 < SmoothPorcupine> cat, grep, sed...
19:19 < jnwhiteh> and its clear that the concept you're presenting isn't
clearly defined, so I think that would help.
19:20 < jnwhiteh> write me a cat function then =)
19:20 < SmoothPorcupine> Anything that requires memory allocation.
19:20 < SmoothPorcupine> I did.  funct
cat(file){print(return_every_block(file,4096))}
19:21 < SmoothPorcupine> func*
19:21 < jnwhiteh> whats the definition of return_every_block?
19:21 < jnwhiteh> given that that is the only function that actually does
anything
19:21 < jnwhiteh> pseudo-code is fine, obviously
19:21 < SmoothPorcupine> It was the read() I comment-defined before.  I
renamed it to be clearer.
19:22 < jnwhiteh> so its func read(file *os.File, bsize int) { for { return
file.Read(bsize); } }
19:23 < SmoothPorcupine> Would that automatically exit on EOF?
19:23 < jnwhiteh> sure, pretend it does
19:23 < SmoothPorcupine> Neat.  Yes.
19:23 < plexdev> http://is.gd/s7Z9RX by [Russ Cox] in go/src/pkg/runtime/ --
runtime: stop deadlock test properly (fix arm5 build)
19:24 < SmoothPorcupine> Only problem is that Read() takes a buffer doesn't
it?
19:24 < SmoothPorcupine> Otherwise you've go the sequentiality problem.
19:24 < SmoothPorcupine> got*
19:25 < jnwhiteh> its your language ,not mine =)
19:25 < jnwhiteh> I don't know.
19:25 < SmoothPorcupine> print(return_every_block(file,make([4096]buf)))
19:26 < huin> pointer equality checking is an identity test, right?
19:26 < SmoothPorcupine> Or you could make the buffer in return_every_block,
where it makes sense.
19:26 < SmoothPorcupine> I think (hope :V) you understand the well enough
now.
19:26 < SmoothPorcupine> I have to go.
19:27 < SmoothPorcupine> Again, if this has ever been implemented, I don't
know about it and would like to.
19:27 < jnwhiteh> well have fun with that.
19:27 < jnwhiteh> =)
19:27 < SmoothPorcupine> (Because I wont really know what improvements tihs
has until I start using it.)
19:27 < jnwhiteh> if Go had generators this would be not necessary
19:28 < SmoothPorcupine> this*
19:28 < dforsyth> so the debug stuff only works on linux?  :(
19:28 < SmoothPorcupine> Multiple returns obsoletes generators.  ;D
19:28 -!- arun_ [~arun@unaffiliated/sindian] has joined #go-nuts
19:28 < jnwhiteh> SmoothPorcupine: generators have clear semantics
19:29 < jnwhiteh> well-defined =)
19:29 < jnwhiteh> SmoothPorcupine: http://paste.pocoo.org/show/376524/
19:29 < jnwhiteh> if Go supported generators
19:29 < jnwhiteh> its just a few lines of change to work with Go currently
19:29 < jnwhiteh> and they're pretty much the same exact code
19:29 < SmoothPorcupine> In the sene of common usage, it does the main
purpose of generators.
19:30 < SmoothPorcupine> In fact, range() is kinda a multiple return
function...
19:30 < jnwhiteh> with the hidden semantic ambiguity of being a concurrency
construct as well
19:30 < jnwhiteh> that's very confusing =)
19:30 < jnwhiteh> violates KISS quite a bit
19:31 -!- Glasswalker [~Glasswalk@bas1-kingston08-1128729056.dsl.bell.ca] has
joined #go-nuts
19:31 < SmoothPorcupine> Multiple returns would violate a lot of things.
19:31 < jnwhiteh> all three: http://paste.pocoo.org/show/376526/
19:32 < jnwhiteh> "What does it gain" isn't a reason to not do it
19:32 < SmoothPorcupine> But, surprisingly, not break so much code as you'd
think.  ;)
19:32 < jnwhiteh> I think that's as baseless a claim as the opposite
19:32 < jnwhiteh> given that you yourself still have not clearly defined how
this new construct operates =)
19:33 -!- hopso [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has quit [Ping
timeout: 252 seconds]
19:35 -!- damikin11 [~damikin11@cpe-24-30-179-173.socal.res.rr.com] has joined
#go-nuts
19:37 -!- hcatlin [~hcatlin@pdpc/supporter/professional/hcatlin] has left #go-nuts
[]
19:37 -!- wrtp [~rog@92.17.70.99] has quit [Quit: wrtp]
19:41 < plexdev> http://is.gd/rW5IH8 by [Adam Langley] in 4 subdirs of
go/src/pkg/crypto/ -- crypto/rsa: support > 3 primes.
19:43 -!- imsplitbit [~imsplitbi@64.39.4.132] has quit [Quit: Bye!]
19:53 -!- meanburrito920 [~john@unaffiliated/meanburrito920] has quit [Ping
timeout: 260 seconds]
19:56 -!- carrus85 [~carrus85@64.0.193.15] has quit [Quit: Leaving]
19:58 < plexdev> http://is.gd/P92LM9 by [Adam Langley] in
go/src/pkg/crypto/rsa/ -- crypto/rsa: add file that I forgot to add last time.
19:58 < plexdev> http://is.gd/A32gLZ by [Petar Maymounkov] in
go/src/pkg/http/ -- http: in ServerConn and ClientConn, rename Close to Hijack,
add Close
19:59 -!- kr [~kr@24.5.193.165] has joined #go-nuts
20:01 -!- dRbiG [drbig@unhallowed.pl] has quit [Remote host closed the connection]
20:03 -!- kr [~kr@24.5.193.165] has quit [Read error: No route to host]
20:03 -!- pothos_ [~pothos@111-240-164-129.dynamic.hinet.net] has joined #go-nuts
20:04 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 258 seconds]
20:04 -!- pothos [~pothos@111-240-169-22.dynamic.hinet.net] has quit [Ping
timeout: 240 seconds]
20:05 -!- ccallahan [~name@ip68-102-215-66.ks.ok.cox.net] has joined #go-nuts
20:07 -!- hopso [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has joined
#go-nuts
20:10 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
20:11 < SmoothPorcupine> jnwhiteh, oh shoot.  I forgot.  I said no implied
returns.  Calling cat() would be the last thing you ever do.
20:11 -!- aho [~nya@fuld-590c6464.pool.mediaWays.net] has joined #go-nuts
20:12 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has joined
#go-nuts
20:12 < jnwhiteh> again, have fun with that =)
20:12 < SmoothPorcupine> But let's forget what I said.  Maybe there is meriy
in implicit returns...
20:12 < SmoothPorcupine> merit*
20:12 < SmoothPorcupine> I will!
20:12 -!- edsrzf [~chickench@122-61-221-144.jetstream.xtra.co.nz] has joined
#go-nuts
20:13 < jnwhiteh> I'll be here if you ever clearly define this :P
20:13 < SmoothPorcupine> As soon as I find/make a language that lets me play
around with it.  :V
20:14 < skelterjohn> what is an implicit return?
20:14 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
20:14 < SmoothPorcupine> jnwhiteh, if you put the implied return at the end
of cat, it'll return as many times as return_every_block does.
20:16 < SmoothPorcupine> So cat() has to either return before
return_every_block, or return_every_block has to return an EOF somehow.
20:17 < SmoothPorcupine> The difference being the concurrence of the file
dump.
20:17 -!- skelterjohn [~jasmuth@c-24-0-2-70.hsd1.nj.comcast.net] has quit [Quit:
skelterjohn]
20:22 -!- hopso [5b9a07e9@gateway/web/freenode/ip.91.154.7.233] has quit [Ping
timeout: 252 seconds]
20:23 -!- kr [~kr@37.sub-174-254-225.myvzw.com] has joined #go-nuts
20:24 -!- dchest [~dchest@78.155.49.42] has quit [Quit: dchest]
20:25 -!- foocraft [~dsc@178.152.67.40] has quit [Read error: Connection reset by
peer]
20:26 < SmoothPorcupine> So which of these three is the best implied return?
20:26 -!- foocraft [~dsc@78.101.180.34] has joined #go-nuts
20:31 < plexdev> http://is.gd/zAKeDg by [David Symonds] in
go/src/pkg/container/heap/ -- container/heap: fix circular dependency in test
20:34 -!- crodjer [~rohanjain@203.110.240.205] has quit [Quit: Leaving]
20:34 -!- crodjer [~rohanjain@203.110.240.205] has joined #go-nuts
20:37 -!- dchest [~dchest@78.155.49.42] has joined #go-nuts
20:38 -!- kamaji [~kamaji@cpc2-aztw22-2-0-cust775.aztw.cable.virginmedia.com] has
quit [Quit: bbl]
20:41 -!- sjbrown [~sjbrown@adsl-99-189-162-6.dsl.pltn13.sbcglobal.net] has quit
[Ping timeout: 240 seconds]
20:44 -!- tdc [~santegoed@host217-44-215-18.range217-44.btcentralplus.com] has
joined #go-nuts
20:44 -!- g0bl1n [~g0blin@unaffiliated/g0bl1n] has quit [Quit: g0bl1n]
20:45 -!- stalled [~stalled@unaffiliated/stalled] has quit [Quit: ...]
20:46 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 260 seconds]
20:50 -!- tdc [~santegoed@host217-44-215-18.range217-44.btcentralplus.com] has
quit [Quit: tdc]
20:50 -!- kr [~kr@37.sub-174-254-225.myvzw.com] has quit [Remote host closed the
connection]
20:50 -!- g0bl1n [~g0blin@a213-22-18-58.cpe.netcabo.pt] has joined #go-nuts
20:50 -!- g0bl1n [~g0blin@a213-22-18-58.cpe.netcabo.pt] has quit [Changing host]
20:50 -!- g0bl1n [~g0blin@unaffiliated/g0bl1n] has joined #go-nuts
20:53 -!- g0bl1n [~g0blin@unaffiliated/g0bl1n] has quit [Client Quit]
20:53 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
20:58 -!- kr [~Keith@204.14.152.118] has joined #go-nuts
21:01 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has joined #go-nuts
21:04 -!- femtoo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Ping
timeout: 250 seconds]
21:25 -!- huin [~huin@91.84.99.134] has quit [Quit: leaving]
21:26 -!- JusticeFries [~JusticeFr@66.210.206.32] has quit [Quit: JusticeFries]
21:26 -!- huin [~huin@91.84.99.134] has joined #go-nuts
21:30 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-163-29.clienti.tiscali.it] has
joined #go-nuts
21:38 -!- huin [~huin@91.84.99.134] has quit [Quit: leaving]
21:43 < ccallahan> Okay, I have been looking all over the interwebs for a
example, but have found nothing.  How do you download a file and save it using
http.Get </noob>
21:43 < ccallahan> ?
21:47 < boomtopper> hi ccallahan I'm a bit of a noob myself but I've done
imgResp, _, err := http.Get(v)
21:47 < boomtopper> imageData, _ := ioutil.ReadAll(imgResp.Body)
21:47 < boomtopper> fileName := path.Base(v)
21:47 < boomtopper> ioutil.WriteFile(fileName, imageData, 0666)
21:47 < boomtopper> That's without any error checking though
21:48 -!- femtooo [~femto@95-89-249-242-dynip.superkabel.de] has quit [Read error:
Connection reset by peer]
21:56 -!- crodjer [~rohanjain@203.110.240.205] has quit [Quit: Leaving]
22:01 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
22:03 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
22:04 -!- Fish- [~Fish@9fans.fr] has quit [Quit: So Long, and Thanks for All the
Fish]
22:09 -!- Venom_X [~pjacobs@66.54.185.133] has quit [Ping timeout: 258 seconds]
22:15 -!- piranha [~piranha@5ED43A0B.cm-7-5a.dynamic.ziggo.nl] has quit [Quit:
Computer has gone to sleep.]
22:16 -!- m4dh4tt3r [~Adium@c-69-181-217-82.hsd1.ca.comcast.net] has quit [Quit:
Leaving.]
22:25 -!- photron_ [~photron@port-92-201-40-159.dynamic.qsc.de] has quit [Ping
timeout: 276 seconds]
22:27 -!- JusticeFries [~JusticeFr@66.210.206.32] has joined #go-nuts
22:31 -!- rlab [~Miranda@91.200.158.34] has quit [Ping timeout: 248 seconds]
22:34 -!- JusticeFries [~JusticeFr@66.210.206.32] has quit [Quit: JusticeFries]
22:35 -!- gtaylor [~gtaylor@99-5-124-9.lightspeed.gnvlsc.sbcglobal.net] has quit
[Quit: gtaylor]
22:40 -!- |Craig| [~|Craig|@panda3d/entropy] has joined #go-nuts
22:42 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has joined
#go-nuts
22:42 -!- thomas_b [~thomasb@cm-84.215.47.51.getinternet.no] has quit [Quit:
leaving]
22:47 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
22:51 -!- dreadlorde [~dreadlord@c-24-11-39-160.hsd1.mi.comcast.net] has quit
[Ping timeout: 248 seconds]
22:56 -!- Scorchin [~Scorchin@host109-158-115-56.range109-158.btcentralplus.com]
has quit [Quit: Scorchin]
23:10 -!- ExtraSpice [XtraSpice@88.118.35.153] has quit [Read error: Connection
reset by peer]
23:12 -!- JusticeFries [~JusticeFr@66.210.206.32] has joined #go-nuts
23:12 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has quit [Ping timeout: 250
seconds]
23:14 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
23:19 -!- iant [~iant@nat/google/x-fmxefvsvtbfzxvsq] has quit [Quit: Leaving.]
23:27 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has quit [Read error:
Connection reset by peer]
23:28 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
23:30 -!- JusticeFries [~JusticeFr@66.210.206.32] has quit [Quit: JusticeFries]
23:33 -!- iant [~iant@66.109.105.216] has joined #go-nuts
23:33 -!- mode/#go-nuts [+v iant] by ChanServ
23:34 -!- boomtopper
[~boomtoppe@cpc12-nrte22-2-0-cust249.8-4.cable.virginmedia.com] has quit [Ping
timeout: 276 seconds]
23:34 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
23:34 < plexdev> http://is.gd/aZSD1x by [Robert Griesemer] in go/doc/ -- go
spec: for map types, mention indexing operations
23:35 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-163-29.clienti.tiscali.it] has
quit [Quit: E se abbasso questa leva che succ...]
23:39 -!- boscop [~boscop@f055131202.adsl.alicedsl.de] has quit [Ping timeout: 240
seconds]
23:39 -!- boscop_ [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
23:42 -!- kr [~Keith@204.14.152.118] has left #go-nuts ["WeeChat 0.3.2"]
23:51 < dchest> Do maps in Go shrink when deleting items?
23:52 < edsrzf> What do you mean?
23:52 -!- JusticeFries [~JusticeFr@66.210.206.32] has joined #go-nuts
23:53 < dchest> If I push 1,000,000 into the map, and then remove 500,000,
will some memory be freed?
23:53 < edsrzf> I don't think the language provides any guarantees, but it
seems like a reasonable assumption that some memory would be freed.
23:54 -!- iant1 [~iant@32.154.215.211] has joined #go-nuts
23:54 < dchest> my dump tests show that may not be the case :(
23:54 < exch> Go currently does not release claimed memory back to the OS.
it is reused for other bits in the process though
23:55 < dchest> *dumb
23:55 < dchest> tests
23:55 < edsrzf> exch is right about that
23:55 -!- iant1 [~iant@32.154.215.211] has quit [Client Quit]
23:55 < dchest> oh, ok.  thanks
23:56 -!- iant [~iant@66.109.105.216] has quit [Ping timeout: 252 seconds]
23:57 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 252
seconds]
23:58 -!- boscop_ [~boscop@f055131202.adsl.alicedsl.de] has quit [Ping timeout:
240 seconds]
23:59 -!- boscop_ [~boscop@f055131202.adsl.alicedsl.de] has joined #go-nuts
--- Log closed Sat Apr 23 00:00:50 2011