--- Log opened Sat Sep 18 00:00:07 2010
00:07 -!- Xurix [~Luixsia@AToulouse-254-1-55-249.w81-49.abo.wanadoo.fr] has quit
[Quit: Leaving]
00:07 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
00:09 -!- ukai [~ukai@nat/google/x-lxyflooxpisypvth] has quit [Ping timeout: 264
seconds]
00:11 -!- ukai [~ukai@nat/google/x-gcectuhpiukboyfa] has joined #go-nuts
00:15 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Quit: Leaving]
00:18 -!- crazy2be [~justin@d205-206-130-118.abhsia.telus.net] has joined #go-nuts
00:18 -!- lmoura_ [~lauromour@187.113.125.80] has quit [Quit: Leaving]
00:19 < crazy2be> Hello, is there any way i can use the json library to
essentally replace the JSON.parse() function from javascript?
00:19 < crazy2be> That is, i want to be able to make an interface{} and
access the data by name with minimal pain
00:19 < crazy2be> E.g.  defining all the fields in the structs all the way
down would constitute pain
00:20 -!- photron [~photron@port-92-201-57-106.dynamic.qsc.de] has quit [Read
error: Operation timed out]
00:21 -!- ako [~nya@fuld-4d00d3da.pool.mediaWays.net] has quit [Ping timeout: 245
seconds]
00:22 -!- jcao219 [~jcao219@pool-173-74-61-111.dllstx.fios.verizon.net] has quit
[Ping timeout: 245 seconds]
00:28 < crazy2be> I'm willing to write my own package if necessary, i guess
the question is whether the language supports it, and how i would go about
implementing it
00:29 < crazy2be> In C++ I could simply override the [] operator (well, not
really simply, but i could do it)
00:30 < exch> If you stick with a map of interface{} values, you'll be stuck
with a lot of casting to/from go types to get at the values.  it's a pain in the
proverbial hiney.  Just defining the structs with proper field names is the only
way to make it usable as far as I know
00:31 < crazy2be> I figured as much, it's just a pain
00:31 < crazy2be> mostly because i'm retrieving the JSON feed from elsewhere
00:32 < crazy2be> and it might change at any time
00:32 < crazy2be> potentially breaking things
00:32 < crazy2be> I suppose i'll go about that then :)
00:32 < exch> If your code needs to handle the json feed, it has to know
it's format.  In which case you may as well go with the struct approach
00:32 < exch> the code will break regardless of how you implement it, if the
feed changes it's format
00:33 < crazy2be> well, only a few nodes are relevant to me
00:33 < crazy2be> Right now i just have it rendering based on that feed with
javascript
00:33 < crazy2be> but that's slow
00:33 < crazy2be> and bad
00:33 < crazy2be> But it's really simple
00:34 < crazy2be> like
00:34 -!- aho [~nya@fuld-4d00d2b1.pool.mediaWays.net] has joined #go-nuts
00:34 < crazy2be> http://pastebin.com/XSH3K9uW
00:35 < crazy2be> i only care about a few things
00:35 < crazy2be> quite a few in the individual entries
00:35 < crazy2be> but there's lots and lots of crud
00:35 < crazy2be> eh well
00:35 < crazy2be> i wonder
00:35 < crazy2be> what happenes if i only implement the parts i care about
00:36 < cbeck> That should work
00:36 < cbeck> The rest will get ignored
00:36 < exch> the rest will be silently ignored.  But you have to start at
the top-level object and define the object tree all the way down to the bits you
want
00:36 < crazy2be> yikes!  they redesigned the website!
00:37 < crazy2be> and nacl is enabled by default?
00:37 < crazy2be> hmm
00:37 < crazy2be> oh, nvm
00:37 < crazy2be> it runs on their servers
00:37 < Namegduf> Doing it by NaCl would be cool.
00:38 < crazy2be> NaCl is an awesome concept :)
00:38 < crazy2be> i'm waiting for it to mature to the point i can use it
00:38 < cbeck> But remember that you don't have to define new types, so you
can do 'type JSONFeed struct { Foo struct {Bar struct {Baz string}}}'
00:38 -!- nighty^ [~nighty@x122091.ppp.asahi-net.or.jp] has quit [Read error:
Connection reset by peer]
00:38 < crazy2be> cbeck: Thanks!  I would certainly of gone about it a
silly, any more difficult, way :P
00:39 < crazy2be> cbeck: And i access them with (some JSONFeed
object).Foo.Bar, right?
00:40 < cbeck> Right
00:42 -!- iant [~iant@67.218.106.92] has quit [Quit: Leaving.]
00:43 -!- jhawk28 [~jhawk28@user-142gfte.cable.mindspring.com] has joined #go-nuts
00:43 < bfrank> is there anyway to import a single function from a package?
00:44 -!- jhawk28 [~jhawk28@user-142gfte.cable.mindspring.com] has quit [Remote
host closed the connection]
00:44 < crazy2be> bfrank: You could make a package that implements that one
function, and import that instead
00:44 < crazy2be> like, make a custom package that just assigns that
function to something internal to is
00:44 < crazy2be> *it
00:44 < crazy2be> so like
00:45 < crazy2be> import "http"
00:45 < crazy2be> DoSomething := http.DoSomething
00:45 < crazy2be> and then import that package rather than the http package
00:45 < bfrank> hmm, let me try that
00:45 < bfrank> also, does anyone know why the play stuff isn't in the repo?
00:46 < bfrank> when you do that code, what type is DoSomething at that
point, a func?
00:46 < crazy2be> yes
00:46 < crazy2be> although it really doesn't matter
00:47 < crazy2be> since := will initialize it to whatever
00:47 < bfrank> so when you do that assignment, you are assigning the
existing http.DoSomething to a new variable and that DoSomething variable is
exported because it is capital?
00:47 < crazy2be> As i understand it
00:48 < bfrank> I am also confused why the go compiler puts implicit
semicolons after every line, rather than using godoc to add them
00:48 -!- nf_ [~nf@124.169.158.192] has joined #go-nuts
00:49 -!- anticw_ [~anticw@c-67-169-41-113.hsd1.ca.comcast.net] has joined
#go-nuts
00:49 < crazy2be> bfrank: Er?
00:49 < bfrank> like, I can't say
00:49 < KirkMcDonald> godoc?  Do you mean gofmt?
00:49 < bfrank> func test ()
00:49 < bfrank> {
00:49 < bfrank> yeah, gofmt, that is what I meant
00:49 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 255 seconds]
00:49 < crazy2be> because it's easier to type :P
00:49 -!- anticw [~anticw@c-67-169-41-113.hsd1.ca.comcast.net] has quit [Write
error: Broken pipe]
00:49 -!- nf [~nf@124.169.158.192] has quit [Write error: Broken pipe]
00:49 < crazy2be> i don't run gofmt at every compile
00:49 < KirkMcDonald> bfrank: gofmt is going to move that curly brace
anyway.
00:50 -!- nighty^ [~nighty@x122091.ppp.asahi-net.or.jp] has joined #go-nuts
00:50 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
00:50 < KirkMcDonald> Er. Or is gofmt just going to barf on that?
00:50 < KirkMcDonald> I think it barfs.
00:51 < KirkMcDonald> bfrank: Anyway:
http://golang.org/doc/go_spec.html#Semicolons
00:52 < bfrank> also, why does the website or the docs I've read, not
mention anything about linux kernel 2.6 being the minimum requirement for the
goroutines stuff?
00:52 < bfrank> actually, I don't think I've seen any docs about what
exactly the requirements exactly even are
00:52 < cbeck> I remember reading that, but I don't remember where
00:52 < crazy2be> bfrank: i imagine because that's implementation-specific
00:53 < crazy2be> and the compilers are not really stable now
00:53 < crazy2be> so things like that might change
00:53 < crazy2be> a lot, potentially
00:53 < bfrank> well, it just seems weird not to have the site reflect that
in the installation docs or something
00:53 < bfrank> since that is likely to be something people are going to
want to know before they compile and try to use it for anything
00:54 < crazy2be> Well it has all the other requirements on the install page
00:54 < crazy2be> i guess i always just run the latest linux kernel
00:54 < crazy2be> or whatever ubuntu gives me
00:55 < bfrank> yeah, and it seems like that works ok, but not every person
has the luxury of having the latest greatest stuff
00:56 < crazy2be> What OS?
00:56 < bfrank> what is the best way to do something like a scanf or
something in go
00:56 < bfrank> Linux, but like, let's say kernel 2.4
00:56 < crazy2be> distro?
00:57 < bfrank> Redhat enterprise linux
00:57 < vsmatck> bfrank: Look in the fmt package.
00:57 < crazy2be> fmt.Scanf() :)
00:57 < bfrank> hmm
00:58 < crazy2be> hmm i keep getting an InvalidUnmarshalError
00:58 -!- vdrab [~vdrab@EM114-51-196-54.pool.e-mobile.ne.jp] has joined #go-nuts
00:58 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has joined #go-nuts
01:01 -!- piyushmishra [~piyushmis@117.200.226.188] has quit [Ping timeout: 240
seconds]
01:02 < crazy2be> hmm :/
01:02 < bfrank> another question, why are the binaries that 8g/8l create so
much bigger than a equivalent c compiled program with gcc?
01:02 < crazy2be> there are $ in the names of the JSON variables
01:02 < crazy2be> go doesn't like that :(
01:03 < crazy2be> bfrank: Compilers are more optimized, smaller standard
library
01:03 < crazy2be> same sort of idea as C vs C++
01:03 < bfrank> you mean gcc is more optimized, and has a smaller standard
library?
01:03 < Namegduf> bfrank: They are statically compiled.
01:04 < Namegduf> And do not depend on an external stdlib.
01:04 < bfrank> hmm
01:04 < Namegduf> The parts of the stdlib each program uses is built into
each program.
01:04 < Namegduf> That is why.
01:04 < crazy2be> Namegduf: Is that by default (with C, that is)?
01:04 < Namegduf> No, it isn't.
01:04 < bfrank> is there a way to make it not do that?
01:04 < crazy2be> Because you can statically link them
01:04 < crazy2be> with C
01:04 < Namegduf> You *can*, but it definitely is not default.
01:05 < Namegduf> GCC will normally produce, and the apps you are comparing
against are, dynamically linked executables.
01:05 < bfrank> is there a way to make go compile dynamically linked
executables?
01:05 < Namegduf> No.
01:05 < crazy2be> Probably not because of the multithreading
01:05 < Namegduf> The size increase should not matter for any real program.
01:06 < bfrank> I can always run gzexe
01:06 < bfrank> but nevertheless, heh
01:06 < Namegduf> And you would need to ship a libgo.so or something with
your program to be Go's equivalent of glibc.
01:09 < crazy2be> Namegduf: However, dynamic linking usually means a faster
compile
01:09 < crazy2be> in my experience with C++, anyway
01:09 < bfrank> I mean, go does compile pretty fast, though
01:10 < Namegduf> crazy2be: I don't think you can, without additional
information, assume that would apply to Go as well.
01:10 < crazy2be> Namegduf: No, but with C++ it was simply because it had
less to read/write to disk
01:11 < crazy2be> all those libraries were large by the end
01:11 -!- steveno [~stevenoli@paludis/cheerleader/steveno] has joined #go-nuts
01:11 < bfrank> Does go have a way of pushing datastructures over sockets to
other go programs running on remote machines?
01:11 < Namegduf> I'm quite sure that disk I/O was not the limiting factor
of C++ compilation.
01:11 < Namegduf> Just, you know, a guess, but
01:11 < Namegduf> When they produce similarly sized executables but one
takes five minutes and another takes 3 seconds...
01:12 < crazy2be> No, but it was for the linking, i think
01:12 < crazy2be> since that is after the compiling
01:12 < plexdev> http://is.gd/ffNO7 by [Alex Brainman] in go/src/pkg/ --
pkg/Makefile: disable netchan test to fix windows build
01:12 < crazy2be> anyway, this is a silly argument
01:12 < vsmatck> bfrank: ya, the rpc package does that.
01:12 < cbeck> bfrank: Check out the gob package
01:12 < bfrank> thanks
01:12 < crazy2be> since neither of us know enough :P
01:13 < bfrank> wow, sweet, that sounds like what I would want
01:13 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 245 seconds]
01:14 < crazy2be> Any idea how i can replace "$", read from an io.Reader,
with something else, say "_", and still return an io.Reader (so that it is
essentially transparent to existing code)?
01:14 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
01:15 < crazy2be> So like Reader := replacer.ReplaceReader(SomeOtherReader,
"$", "_")
01:16 < Namegduf> Create a type on a struct just containing an io.Reader
with a Read method
01:16 -!- piyushmishra [~piyushmis@117.200.225.136] has joined #go-nuts
01:16 < Namegduf> Have the Read method read from the reader and do the
replacement before returning the results.
01:17 < Namegduf> With that design, you'd want it to contain the two
characters in the struct, too, as members.
01:18 -!- stalled [~stalled@unaffiliated/stalled] has quit [Write error: Broken
pipe]
01:26 -!- Bombe [~droden@weltgehirnmaschine.de] has quit [Excess Flood]
01:27 -!- mbohun [~mbohun@ppp115-156.static.internode.on.net] has joined #go-nuts
01:27 -!- Bombe [~droden@weltgehirnmaschine.de] has joined #go-nuts
01:28 -!- vdrab [~vdrab@EM114-51-196-54.pool.e-mobile.ne.jp] has quit [Ping
timeout: 245 seconds]
01:30 -!- mumbow [~mumboww@c-98-207-108-218.hsd1.ca.comcast.net] has quit [Quit:
mumbow]
01:31 -!- erje_ [~erje@port-92-201-26-103.dynamic.qsc.de] has joined #go-nuts
01:33 -!- erje [~erje@port-92-201-3-205.dynamic.qsc.de] has quit [Ping timeout:
272 seconds]
01:35 -!- iant [~iant@adsl-71-133-8-30.dsl.pltn13.pacbell.net] has joined #go-nuts
01:35 -!- mode/#go-nuts [+v iant] by ChanServ
01:36 < crazy2be> i keep forgetting how go works and trying to write C/C++
01:36 < crazy2be> bad!
01:38 -!- synth [~cb@obfuscated.us] has quit [Ping timeout: 358 seconds]
01:38 -!- synth [~cb@obfuscated.us] has joined #go-nuts
01:43 -!- gnuvince [~vince@70.35.169.91] has quit [Ping timeout: 255 seconds]
01:43 < plexdev> http://is.gd/ffPmM by [Rob Pike] in 2 subdirs of
go/src/pkg/ -- windows: fix netchan test by using 127.0.0.1.
01:44 -!- SRabbelier [~SRabbelie@ip138-114-211-87.adsl2.static.versatel.nl] has
joined #go-nuts
01:45 -!- gnuvince [~vince@70.35.165.150] has joined #go-nuts
01:48 < bfrank> are there any numeric types bigger than uint64?
01:48 < cbeck> there's a bigint package
01:48 < cbeck> err, big
01:49 < bfrank> thanks, going to try messing with that
01:50 < bfrank> apparently I am overflowing a uint64
01:50 < bfrank> heh
01:59 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
01:59 < crazy2be> the string vs []byte distinction is confusing me
01:59 < crazy2be> mainly because i don't understand how to convert between
them
02:00 < Namegduf> []byte(someString)
02:00 < Namegduf> string(someByteSlice)
02:00 < crazy2be> wow
02:00 < crazy2be> that's easy
02:01 < crazy2be> thanks!
02:02 < crazy2be> I was thinking maybe type assertions
02:02 < crazy2be> like somString.([]byte)
02:02 <+iant> type assertions are for converting from an interface type to
some other type
02:03 <+iant> type conversions are for converting other types
02:03 <+iant> the difference is that a type assertion can fail at runtime
02:03 <+iant> a type conversion can only fail at compile time
02:06 -!- Tv [~tv@cpe-76-168-227-45.socal.res.rr.com] has joined #go-nuts
02:07 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 276 seconds]
02:08 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
02:10 -!- dacc [~Adium@D-128-95-10-177.dhcp4.washington.edu] has quit [Ping
timeout: 240 seconds]
02:11 < crazy2be> implicit assignment of unexported field 'from' of
replace.Replacer in method receiver
02:12 < crazy2be> What does that mean in plain english?
02:12 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
02:15 < crazy2be> and why is it complaining?
02:18 < crazy2be> now i have a null character
02:18 < crazy2be> somehow
02:18 < crazy2be> :/
02:19 < crazy2be> Error: "invalid character '\\x00'
02:19 -!- boscop_ [~boscop@g226228196.adsl.alicedsl.de] has joined #go-nuts
02:20 -!- boscop [~boscop@f055100251.adsl.alicedsl.de] has quit [Ping timeout: 245
seconds]
02:21 < crazy2be> oh right i should do EOF checking
02:23 <+iant> the "implicit assignment" error means that you are copying a
struct with a private field--the struct has a field whose name starts with a lower
case letter, and code that is in a different package is copying it
02:23 <+iant> in this case perhaps because you are using a receiver which is
not a pointer
02:24 < crazy2be> oh
02:24 < crazy2be> that was not what i was expecting :P
02:24 < crazy2be> I "fixed" it by changing all the fields to uppercase
02:24 < crazy2be> or, rather, camelcase
02:26 -!- dacc [~Adium@D-69-91-168-87.dhcp4.washington.edu] has joined #go-nuts
02:26 -!- dacc [~Adium@D-69-91-168-87.dhcp4.washington.edu] has left #go-nuts []
02:32 < crazy2be> Hmm perhaps i do not understand how slices work
02:32 < crazy2be> but it seems my slice is getting passed by value
02:33 < nsf> everything is passed by value
02:33 < nsf> slice is just a reference to an array
02:33 < crazy2be> But isn't a slice a pointer value under the covers?
02:33 < nsf> yes it is
02:33 < nsf> but if you're passing a pointer by value
02:34 < nsf> you have the pointer that points to the same place
02:34 < crazy2be> yes, but it is not behaving like that :/
02:34 < crazy2be> i allocate like var buf = make([]byte, 100)
02:34 < crazy2be> Read from it
02:34 < crazy2be> _, _ = rep.Read(buf)
02:35 < crazy2be> and then get all nulls when i print it
02:35 < crazy2be> despite the fact that INSIDE the function it has value
02:35 < nsf> you're doing something wrong
02:36 < crazy2be> 25 lines of code for the package:
http://pastebin.com/Ua55rQRr
02:37 < nsf> well, I can't help you with that
02:37 -!- drhodes [~none@207.3.149.84] has joined #go-nuts
02:37 < nsf> I just tried to explain what the slice is
02:38 < bfrank> so is a slice just a pointer to an array?
02:38 < nsf> underneath slice is that C struct: struct { void *data; int
length; int capacity; }
02:39 < crazy2be> yeah but...  it's not working like that
02:39 < nsf> so, yes..  it's a pointer to an array with few additional
fields
02:39 < crazy2be> i'll try it in the sandbox
02:40 < nsf> crazy2be: then you or me is a liar
02:40 < nsf> :)
02:40 < crazy2be> well
02:40 < crazy2be> that's how the spec describes it
02:40 < crazy2be> but you can see i assign to it
02:40 -!- jA_cOp__ [~yakobu@ti0043a380-1389.bb.online.no] has quit [Read error:
Connection reset by peer]
02:41 < crazy2be> and then print the value of the variable i just assigned
to
02:41 < crazy2be> which works as expected
02:41 < crazy2be> but outside the function, it does not
02:41 < crazy2be> just prints nulls
02:41 -!- jA_cOp__ [~yakobu@ti0043a380-1389.bb.online.no] has joined #go-nuts
02:42 < nsf> what can I say, in my 5kloc app slices work as slices
02:42 < crazy2be> just don't know where to get an io.Reader to test it with
in the sandbox
02:44 < crazy2be> since there is no filesystem or networking
02:45 -!- araujo [~araujo@190.199.102.96] has joined #go-nuts
02:45 -!- araujo [~araujo@190.199.102.96] has quit [Changing host]
02:45 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
02:46 < nsf> i think there is no point to use sandbox if you have a compiler
environment installed
02:48 < nsf> http://pastie.org/1166071
02:48 < nsf> you can compile this in a sandbox
02:48 < nsf> and run
02:49 -!- gnuvince [~vince@70.35.165.150] has quit [Read error: Operation timed
out]
02:51 < bfrank> Before: [0 0 0 0 0 0 0 0 0 0]
02:51 < bfrank> After: [1 2 3 4 0 0 0 0 0 0]
02:52 < crazy2be> huh
02:52 < nsf> works like a pointer, isn't it
02:52 < crazy2be> that is what i'd expect
02:52 -!- gnuvince [~vince@64.235.212.60] has joined #go-nuts
02:52 < crazy2be> that's how it describes them in some document or another
02:53 < crazy2be> like C arrays
02:53 < crazy2be> kindof
02:53 < nsf> in C there are no arrays
02:53 < nsf> :)
02:54 < crazy2be> well
02:54 < crazy2be> that's what they are refered too
02:54 < jesusaurus> sure it does
02:54 < crazy2be> as
02:55 < crazy2be> whether or not they are "arrays" is semantics
02:55 < jesusaurus> it's just a (not surprisingly) c-like implementation
02:57 -!- RobertLJ [~quassel@c-68-44-163-191.hsd1.nj.comcast.net] has joined
#go-nuts
02:58 < Namegduf> In C there are arrays.
02:58 < Namegduf> They implicitly cast to pointers quickly, but they are a
distinct type and behave differently with sizeof()
02:58 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 264 seconds]
02:59 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
03:02 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
03:03 < crazy2be> http://pastie.org/1166081
03:03 < crazy2be> that doesn't work
03:03 < crazy2be> why not
03:06 -!- RobertLJ [~quassel@c-68-44-163-191.hsd1.nj.comcast.net] has quit [Ping
timeout: 265 seconds]
03:06 < crazy2be> because that's close to what i'm doing
03:08 < crazy2be> In fact, i just edited to make it demonstrate my example
exactly (almost)
03:08 < crazy2be> And it outputs:
03:08 < crazy2be> Before: [0 0 0 0 0 0 0 0 0 0] In function: [0 1 2 3 4 5 6
7 8 9] After: [0 0 0 0 0 0 0 0 0 0]
03:08 < crazy2be> so i guess i'm replacing the whole slice
03:09 < crazy2be> and it's not being pointer-ish like it should
03:09 < crazy2be> or like i would expect it to
03:09 < crazy2be> but the question is: how do you get around it?
03:10 < crazy2be> i imagine that assigning byte-by-byte would be less than
optimal
03:11 -!- dj2 [~dj2@CPE001f5b35feb4-CM0014048e0344.cpe.net.cable.rogers.com] has
joined #go-nuts
03:11 -!- RobertLJ [~quassel@c-68-44-163-191.hsd1.nj.comcast.net] has joined
#go-nuts
03:11 < cbeck> That doesn't work because s is a copy of buf
03:11 < crazy2be> yes
03:12 < crazy2be> which is what i was doing
03:12 < crazy2be> assigning slice = slice()
03:12 < cbeck> They point to the same place at first, but when you assign
into s, you are creating a new slice and assigning s to it, rather than altering
the memory pointed to by s and buf
03:13 -!- mumbow [~mumboww@c-98-207-108-218.hsd1.ca.comcast.net] has joined
#go-nuts
03:13 < crazy2be> yessir
03:13 < crazy2be> but i can't figure out the best way around it
03:13 < cbeck> if instead you'd said for i := range s {s[i] = i} then you'd
see the change reflected when the func returns
03:13 < crazy2be> is that the best way?
03:14 < cbeck> Depends what you're trying to do
03:15 < crazy2be> Copy something from one io.Reader to the p []byte array,
while replacing one character with another
03:15 -!- Eridius [~kevin@unaffiliated/eridius] has quit [Ping timeout: 276
seconds]
03:20 < nsf> you can also replace this: s = []byte{0, 1, 2, 3, 4, 5, 6, 7,
8, 9}
03:20 < nsf> with: copy(s, []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
03:20 < nsf> if you like syntax form
03:21 < nsf> crazy2be: well..  just read a data to the 'p' from io.Reader,
and then replace needed characters inside it
03:23 -!- zaero [~eclark@valkyrie.buick455.com] has quit [Ping timeout: 276
seconds]
03:23 -!- zaero [~eclark@valkyrie.buick455.com] has joined #go-nuts
03:23 < cbeck> func MyReader(p []byte) (int, os.Error) {read, err :=
stream.Read(p); /*replace bytes in p*/ return read, err}
03:23 < cbeck> Something like that
03:23 -!- kashia_ [~Kashia@port-92-200-219-143.dynamic.qsc.de] has joined #go-nuts
03:24 -!- mumbow [~mumboww@c-98-207-108-218.hsd1.ca.comcast.net] has quit [Ping
timeout: 265 seconds]
03:24 < crazy2be> cbeck: Yeah that's what i'm trying
03:24 -!- drhodes [~none@207.3.149.84] has quit [Ping timeout: 265 seconds]
03:24 -!- gabriel9 [~gabriel9@93.157.192.28] has quit [Ping timeout: 265 seconds]
03:24 -!- Kashia [~Kashia@port-92-200-219-143.dynamic.qsc.de] has quit [Ping
timeout: 265 seconds]
03:24 < crazy2be> although i make a copy because i'm using the RegExp
library for now
03:24 < nsf> crazy2be: but I think there is no function in stdlib that does
replace in-place
03:24 < crazy2be> and it might puke otherwise
03:25 -!- jcao219 [~jcao219@pool-173-74-61-111.dllstx.fios.verizon.net] has joined
#go-nuts
03:25 -!- steveno [~stevenoli@paludis/cheerleader/steveno] has left #go-nuts []
03:25 < crazy2be> Thanks for all your help!
03:26 < crazy2be> I still have not gotten it working, but it is time for
sleep
03:26 < crazy2be> i'll sleep on i
03:26 < crazy2be> *it
03:26 < crazy2be> that usually helps
03:26 < crazy2be> and i figure it out by morning
03:26 -!- crazy2be [~justin@d205-206-130-118.abhsia.telus.net] has left #go-nuts
[]
03:27 -!- crazy2be [~justin@d205-206-130-118.abhsia.telus.net] has joined #go-nuts
03:28 -!- drhodes [~none@207.3.149.84] has joined #go-nuts
03:28 -!- dcat [~dcat@ip70-188-19-141.rn.hr.cox.net] has joined #go-nuts
03:29 < nsf> hehe, recently I was looking at the utf8 package source code
03:29 < nsf> it's funny how Go developers easily accept copy & paste code
03:29 < nsf> it has two internal functions
03:30 < nsf> decodeRuneInternal and decodeRuneInStringInternal
03:30 < nsf> both do the same thing
03:30 < nsf> line to line
03:30 < nsf> that's a failure
03:31 < crazy2be> Huh
03:31 < nsf> and it's not like a 10 lines functions
03:31 < crazy2be> same types and all?
03:31 < nsf> more like 80 lines of copy&paste
03:31 < nsf> there is only one thing that differs of course
03:31 < nsf> the type of argument
03:31 < nsf> string vs.  []byte
03:32 < nsf> but function logic is the same
03:32 < crazy2be> does it deal with it differently?
03:32 < nsf> nope
03:32 < crazy2be> or just cast to []byte in the string version?
03:32 < nsf> you can't do that because it's not efficient
03:32 < nsf> casting between []byte and string makes copies
03:32 < nsf> afaik
03:33 < nsf> and that forces you to do copy & pastes
03:33 < crazy2be> probably
03:33 < nsf> which is kind of stupid imho
03:33 < crazy2be> :/
03:33 < crazy2be> C++ had templates
03:33 < crazy2be> that would solve a case like that
03:33 < nsf> templates is a wrong solution to that
03:33 < nsf> there is no point to generate code two copies of the code that
does the same thing
03:34 < nsf> s/code//
03:34 -!- jefferai [~quassel@kde/amarok/mitchell] has quit [Ping timeout: 255
seconds]
03:34 < crazy2be> :/
03:34 < crazy2be> I'm getting lots of nulls at the end now
03:35 < nsf> crazy2be: you're full of bugs, fix it
03:35 < crazy2be> i guess that makes sense
03:35 < crazy2be> since some other function makes the slice
03:35 < crazy2be> and i don't know the size
03:36 < crazy2be> it works, very slow though
03:36 < crazy2be> mostly from all the printf
03:36 < nsf> I guess the only solution for string/[]byte problem is escape
analysis
03:37 < nsf> because it will allow making temporary casts from []byte to
string
03:37 < nsf> for a particular function
03:37 < nsf> without copies
03:38 < nsf> although shared memory is a problem
03:38 < nsf> :(
03:39 < crazy2be> theoretically interfaces should solve that
03:39 < crazy2be> for most things
03:39 < nsf> no
03:39 < crazy2be> why not?
03:39 < crazy2be> If you have the same login
03:39 < crazy2be> *logic
03:39 < nsf> because they will make it slower
03:39 < crazy2be> you could have an interface desribing the required logic
03:40 < crazy2be> wouldn't that be checked at compile-time?
03:40 < nsf> interface has the same overhead (or even more) as virtual
function call
03:40 < nsf> it's bad for CPU cache
03:40 < nsf> and in functions like that (decodeRune) locality matters
03:41 < crazy2be> write it in C? :P
03:41 < nsf> won't help
03:41 < crazy2be> assembly?
03:41 < nsf> there is a problem within the language
03:41 < nsf> not within the partucular function
03:41 < nsf> particular*
03:42 < nsf> or actually
03:42 < nsf> even in implementation
03:42 < nsf> and maybe the language too
03:42 -!- RobertLJ [~quassel@c-68-44-163-191.hsd1.nj.comcast.net] has quit [Ping
timeout: 276 seconds]
03:42 < nsf> because it uses shared memory model from C
03:43 < nsf> but it makes sense because we have goroutines multiplexing
03:43 < nsf> and they execute on different threads
03:43 < nsf> so, we can't really use TLS
03:43 < nsf> at all
03:44 < nsf> but at least we can rely on the fact that the memory cannot be
accessed in parallel in some cases
03:44 < nsf> ok, I'm stopping that
03:44 < nsf> thinking won't help
03:45 -!- rup [~rupert@deathknight.net] has quit [Read error: Operation timed out]
03:45 -!- rup [~rupert@deathknight.net] has joined #go-nuts
03:45 < crazy2be> it rarely does :P
03:45 < crazy2be> I've gotten it back to working like it did when i started
03:45 < crazy2be> almost
03:45 < crazy2be> JSONUnmarshaler is still complaining
03:46 < crazy2be> but that's for tommorow
03:46 < crazy2be> goodnight :)
03:47 -!- crazy2be [~justin@d205-206-130-118.abhsia.telus.net] has left #go-nuts
[]
03:52 < nsf> hehe, we can't really do the goroutine escape analysis, even if
it's possible, it's very hard
03:59 -!- vdrab [~vdrab@EM114-51-197-210.pool.e-mobile.ne.jp] has joined #go-nuts
04:05 -!- pocket_ [~pocket_@p1196-ipbf3801hodogaya.kanagawa.ocn.ne.jp] has joined
#go-nuts
04:05 -!- vdrab [~vdrab@EM114-51-197-210.pool.e-mobile.ne.jp] has quit [Ping
timeout: 252 seconds]
04:09 < pocket_> Hello
04:10 < pocket_> I wrote simple echoServer and Client with Go
04:10 < pocket_> Server Code: http://pastebin.com/nKk7zPWX
04:10 < pocket_> Client Code: http://pastebin.com/piC3vK8v
04:11 < pocket_> But when I input some text from client, Then Server print
just newline(\n).
04:11 < pocket_> Why It doesn't work?
04:17 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has joined #go-nuts
04:17 -!- dacc [~Adium@c-67-171-32-251.hsd1.wa.comcast.net] has left #go-nuts []
04:18 < nsf> try inserting after line 40 in client
04:18 < nsf> writer.Flush()
04:19 -!- piyushmishra [~piyushmis@117.200.225.136] has quit [Ping timeout: 252
seconds]
04:21 < pocket_> Thanks nsf
04:21 < pocket_> Work fine.
04:21 < nsf> :)
04:22 < pocket_> And how can I delete last newline from string?
04:23 < pocket_> Is there any function to do it?  like perl's chomp?
04:23 < nsf> there is something like that in 'strings' package
04:23 < nsf> Trim or something
04:23 -!- bugQ [~bug@c-67-171-127-76.hsd1.ut.comcast.net] has joined #go-nuts
04:24 < nsf> you can use TrimRight or TrimSpace
04:24 < nsf> also if you know that there is always a newline
04:24 < nsf> you can simply remove it by slicing string
04:24 < nsf> s[:len(s)-1]
04:24 < pocket_> Hum, Thanks
04:27 -!- piyushmishra [~piyushmis@117.200.224.118] has joined #go-nuts
04:28 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has quit [Ping
timeout: 240 seconds]
04:38 -!- jA_cOp__ [~yakobu@ti0043a380-1389.bb.online.no] has quit [Read error:
Connection reset by peer]
04:38 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has joined
#go-nuts
04:54 -!- enherit [~enherit@71-83-188-75.dhcp.lnbh.ca.charter.com] has joined
#go-nuts
04:55 -!- jcao219 [~jcao219@pool-173-74-61-111.dllstx.fios.verizon.net] has quit
[Ping timeout: 245 seconds]
04:55 -!- jcao219 [~Jimmy_Cao@pool-173-74-61-111.dllstx.fios.verizon.net] has
joined #go-nuts
04:59 -!- MorningSon [~MorningSo@cpe-72-177-219-41.satx.res.rr.com] has quit
[Quit: WeeChat 0.3.0]
05:00 -!- jcao219 [~Jimmy_Cao@pool-173-74-61-111.dllstx.fios.verizon.net] has left
#go-nuts []
05:01 -!- scm [justme@d018136.adsl.hansenet.de] has quit [Ping timeout: 272
seconds]
05:02 -!- scm [justme@d038032.adsl.hansenet.de] has joined #go-nuts
05:02 -!- ikaros [~ikaros@dslb-084-059-076-021.pools.arcor-ip.net] has joined
#go-nuts
05:16 -!- ikaros [~ikaros@dslb-084-059-076-021.pools.arcor-ip.net] has quit [Quit:
Leave the magic to Houdini]
05:17 -!- ikaros [~ikaros@2001:41b8:9bf:fe04:c8b0:b3ff:fed9:2dbc] has joined
#go-nuts
05:21 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has joined #go-nuts
05:25 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Read error: Operation
timed out]
06:16 -!- ikaros [~ikaros@2001:41b8:9bf:fe04:c8b0:b3ff:fed9:2dbc] has quit [Quit:
Leave the magic to Houdini]
06:18 -!- ucasano [~ucasano@host153-182-static.227-95-b.business.telecomitalia.it]
has joined #go-nuts
06:22 -!- Project_2501 [~Marvin@82.84.71.147] has joined #go-nuts
06:32 < cbeck> Hmm, if you recover from a panic, is there a way to get the
stacktrace?
06:33 < nsf> yes
06:33 -!- piyushmishra [~piyushmis@117.200.224.118] has quit [Ping timeout: 240
seconds]
06:33 < nsf> wait a sec I'll give you an example
06:33 < nsf> http://github.com/nsf/gocode/blob/master/server.go#L44
06:33 < nsf> see here section of the code starting from line 44
06:33 < nsf> prints backtrace..
06:34 < nsf> I did it thread safe because I believe it is possible that
multiple goroutines will panic and recover in parallel
06:37 < cbeck> Hmm, I wonder if that'll work here, I'll give it a try
06:37 < cbeck> I'm getting an index out of bounds panic deep in net via
http, but recovering in my code
06:39 -!- erje_ [~erje@port-92-201-26-103.dynamic.qsc.de] has quit [Quit: Leaving]
06:42 < cbeck> Ah, issue 1114.  Oh well
06:45 < nsf> I'm wondering does it makes sense to use Go's map for small
amount of entries like 10-20
06:45 < nsf> s/makes/make/
06:47 < nsf> cause hashmap looks pretty heavy in hashmap.c
06:48 -!- piyushmishra [~piyushmis@117.200.226.247] has joined #go-nuts
06:49 -!- suiside [~suiside@unaffiliated/suiside] has quit [Quit: leaving]
06:51 -!- suiside [~suiside@unaffiliated/suiside] has joined #go-nuts
06:57 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
06:58 < cbeck> nsf: That worked a charm, thanks
07:09 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has quit
[Ping timeout: 276 seconds]
07:10 -!- socratees [~socratees@cpe-76-171-79-40.socal.res.rr.com] has joined
#go-nuts
07:18 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
07:28 -!- aho [~nya@fuld-4d00d2b1.pool.mediaWays.net] has quit [Quit:
EXEC_over.METHOD_SUBLIMATION]
07:30 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
07:31 -!- tsdh [~user@p54AF1F65.dip0.t-ipconnect.de] has joined #go-nuts
07:35 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has quit [Quit: Morten.  Desu~]
07:41 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
07:49 -!- kanru [~kanru@61-228-160-87.dynamic.hinet.net] has quit [Quit: WeeChat
0.3.2]
07:51 -!- enherit [~enherit@71-83-188-75.dhcp.lnbh.ca.charter.com] has quit [Quit:
leaving]
07:54 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
08:02 -!- tsdh [~user@p54AF1F65.dip0.t-ipconnect.de] has quit [Quit: Goodbye
guys!]
08:03 -!- rlab [~Miranda@91.200.158.34] has joined #go-nuts
08:12 -!- napsy [~luka@88.200.96.18] has quit [Quit: Lost terminal]
08:13 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
08:23 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has joined #go-nuts
08:26 -!- photron [~photron@port-92-201-57-106.dynamic.qsc.de] has joined #go-nuts
08:35 -!- sacho [~sacho@213.91.244.15] has joined #go-nuts
08:44 -!- kanru [~kanru@61-228-160-87.dynamic.hinet.net] has joined #go-nuts
08:45 -!- napsy [~luka@88.200.96.18] has quit [Ping timeout: 252 seconds]
08:46 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
08:52 -!- DerHorst [~Horst@e176098253.adsl.alicedsl.de] has joined #go-nuts
08:56 -!- cschmiedl [~alaunos@brln-4dba81c8.pool.mediaWays.net] has joined
#go-nuts
09:02 -!- piyushmishra [~piyushmis@117.200.226.247] has quit [Read error:
Connection reset by peer]
09:07 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 264 seconds]
09:07 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
09:07 -!- MaksimBurnin [~max@44.188-224-87.telenet.ru] has quit [Ping timeout: 240
seconds]
09:07 -!- socratees [~socratees@cpe-76-171-79-40.socal.res.rr.com] has quit [Ping
timeout: 240 seconds]
09:08 -!- boscop_ [~boscop@g226228196.adsl.alicedsl.de] has left #go-nuts []
09:08 -!- boscop [~boscop@g226228196.adsl.alicedsl.de] has joined #go-nuts
09:15 -!- Beg [549f066d@gateway/web/freenode/ip.84.159.6.109] has joined #go-nuts
09:17 -!- illya77 [~illya77@154-115-112-92.pool.ukrtel.net] has joined #go-nuts
09:34 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has joined #go-nuts
09:43 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has quit [Read error: Operation
timed out]
09:43 -!- Beg [549f066d@gateway/web/freenode/ip.84.159.6.109] has quit [Ping
timeout: 252 seconds]
09:52 -!- Beg [549f066d@gateway/web/freenode/ip.84.159.6.109] has joined #go-nuts
09:58 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has joined #go-nuts
10:03 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has quit [Ping timeout: 240
seconds]
10:18 -!- ShadowIce` [pyoro@unaffiliated/shadowice-x841044] has joined #go-nuts
10:18 -!- ShadowIce [~pyoro@unaffiliated/shadowice-x841044] has quit [Read error:
Connection reset by peer]
10:26 -!- illya77 [~illya77@154-115-112-92.pool.ukrtel.net] has quit [Read error:
Connection reset by peer]
10:28 -!- terrex [~terrex@84.122.67.111.dyn.user.ono.com] has joined #go-nuts
10:30 -!- gabriel9 [~gabriel9@93.157.192.28] has joined #go-nuts
10:59 -!- ucasano [~ucasano@host153-182-static.227-95-b.business.telecomitalia.it]
has quit [Quit: ucasano]
11:00 -!- Beg [549f066d@gateway/web/freenode/ip.84.159.6.109] has quit [Ping
timeout: 252 seconds]
11:03 -!- jackman_ [~jackman@c-71-56-158-131.hsd1.wa.comcast.net] has joined
#go-nuts
11:05 -!- Bombe [~droden@weltgehirnmaschine.de] has quit [Changing host]
11:05 -!- Bombe [~droden@freenet/developer/Bombe] has joined #go-nuts
11:07 -!- jackman [~jackman@c-71-56-158-131.hsd1.wa.comcast.net] has quit [Ping
timeout: 276 seconds]
11:07 -!- jA_cOp [~yakobu@unaffiliated/ja-cop/x-9478493] has joined #go-nuts
11:20 -!- araujo [~araujo@gentoo/developer/araujo] has joined #go-nuts
11:21 -!- skejoe [~skejoe@188.114.142.231] has joined #go-nuts
11:36 -!- piyushmishra [~piyushmis@117.200.225.193] has joined #go-nuts
11:36 -!- stalled [~stalled@unaffiliated/stalled] has quit [Ping timeout: 265
seconds]
11:38 -!- jA_cOp_ [~yakobu@unaffiliated/ja-cop/x-9478493] has joined #go-nuts
11:41 -!- jA_cOp [~yakobu@unaffiliated/ja-cop/x-9478493] has quit [Ping timeout:
245 seconds]
11:49 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has joined
#go-nuts
11:49 -!- stalled [~stalled@unaffiliated/stalled] has joined #go-nuts
11:51 -!- pocket_ [~pocket_@p1196-ipbf3801hodogaya.kanagawa.ocn.ne.jp] has quit
[Remote host closed the connection]
12:11 < nsf> hehe, developing fuzzy matching algorithm is interesting..
12:12 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has quit [Quit: Shyde]
12:12 < nsf> example: we have 3 strings: "ABCDEF", "ACBDEF", "CABDEF"; and
the pattern: "ABD" how should we rank these strings?  :)
12:13 < nsf> I can't really answer that question by myself :)
12:14 < vsmatck> Rank them for what purpose?  Edit distance or something?
12:14 < nsf> that's the problem, yes
12:14 < vsmatck> Hm, normally I'd suggest levenschtein.  But that's not
fuzzy.  :)
12:14 < nsf> edit distance is algorithmic term, it has nothing to do with
humans
12:14 < vsmatck> yeah, humans are the fuzzy part.
12:15 < nsf> we need to define "preference" in algorithmic terms somehow :)
12:16 < nsf> currently I have weird formula
12:16 < vsmatck> Hm. Like on google where it does the "did you mean ____"
thing?
12:16 < nsf> it works ok for a lot of cases
12:16 < nsf> but I can't really answer how it should work for that case
12:16 < nsf> maybe it shouldn't
12:16 < nsf> because I as a human can prefer one nonsense over another
12:16 < nsf> :)
12:17 < nsf> can't*
12:17 < vsmatck> Would some sort of 'learning' solution work?  Like you
record all previous searches and if it comes close to one of those you print "Did
you mean foo?"
12:17 < nsf> learning will make the system complex
12:17 < nsf> I don't want that
12:17 < vsmatck> You could have a threshhold on edit distance.  Like if it's
beyond some magic number you fall back on matching to previous searches.
12:17 -!- voker57 [~voker57@kvirc/developer/Voker57] has joined #go-nuts
12:17 < nsf> currently it's very fast
12:18 < nsf> O(N) algorithm for ranking sentence, where N is the length of
that sentence
12:18 < nsf> in characters
12:18 -!- tensorpudding [~user@99.23.122.78] has quit [Quit: ERC Version 5.3 (IRC
client for Emacs)]
12:19 < vsmatck> oh, whole sentences.  Is this a searching problem?  Like
you have the user input a sentence and you return possible matches for documents
or something?
12:19 < nsf> algo does something like that: less shifts is better, less cuts
is better
12:19 < nsf> no
12:19 < nsf> it's kind of a general purpose menu selection algo :)
12:19 < nsf> where sentense is a menu entry
12:19 < nsf> it is something simple usually
12:20 < nsf> like "add cube"
12:20 < nsf> "do this"
12:20 < nsf> etc.
12:20 < nsf> for example we have two entries
12:20 < nsf> "add cube" and "add camera"
12:20 < vsmatck> Ah. I get it.  So you have different menu options and you
have a search box to quickly find different menu elements to do various things.
12:20 < nsf> by typing "acu" we can easily select "add cube"
12:20 < nsf> yes
12:21 < vsmatck> I like how web browsers do this for URLs.  Like you start
typing and it lists a bunch of options.  Then narrows it down as you type more.
12:21 < nsf> well, they do exact match probably
12:21 < vsmatck> I dunno about the mapping of "acu" to "add cube" though.
That seems a little weird to me.
12:21 < nsf> I need fuzzy matches :)
12:21 < nsf> it's not
12:21 < vsmatck> Hm, yeah.  I'
12:22 < nsf> because typing "add cu" is a lot more
12:22 < vsmatck> I'd probably have to use it to understand.  It's unfamiliar
to me anyways.
12:22 < nsf> are you using vim?
12:22 < nsf> I know a plugin for vim that does the same for buffer selection
:)
12:22 < nsf> very nice
12:22 < vsmatck> I have.  I'm by no means an advanced vim user.  I use gedit
for my programming.  :)
12:22 < nsf> i see
12:23 < nsf> anyway the point is, for example you have two files:
autocompletioncontext.go and autocompletionfile.go
12:23 < nsf> real life example, I have those
12:23 < nsf> using this plugin you can easily select one of them
12:23 < nsf> by typing
12:23 < nsf> acon
12:23 < nsf> or afi
12:23 < vsmatck> oh true..  hm.  That would take a while with exact
matching.
12:24 < nsf> yes, that's the point :)
12:24 < vsmatck> However, I like what my BASH shell does with
autocompletion.  I can type something and tab complete.  If I don't like what it
tab completed to I can hit tab multiple times to cycle through different matches.
12:24 < nsf> it is slow and dumb :)
12:25 < nsf> I mean hitting one key many times is a waste of time generally
12:25 < vsmatck> Hm, what about making use of "*".  Like I type auto*file to
select one.
12:25 < nsf> well, that's the part of fuzzy matching
12:25 < nsf> it actually converts a pattern to the glob-style pattern too
12:25 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has quit
[Ping timeout: 245 seconds]
12:26 < nsf> for example 'acon' becomes '*a*c*o*n*'
12:26 < nsf> and if name matches against that
12:26 < vsmatck> oh *thinks*
12:26 < nsf> it does additional ranking magic
12:26 < nsf> for example a1c1o1n is less preferred than aco1n
12:27 < nsf> but they both match the pattern
12:27 < nsf> that's the tricky part I was talking about
12:27 < vsmatck> I see.  That's interesting.  I'm going to get some dew
while I think more.
12:28 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has joined
#go-nuts
12:30 < nsf> http://www.vim.org/scripts/script.php?script_id=1984
12:30 < nsf> vim script that does that thing
12:37 < vsmatck> This seems like a trie traversal problem.
12:38 < vsmatck> Like you know what pieces you need when you're traversing.
In a*b*c you know you need to see a and b and c at least once.
12:39 < vsmatck> So you could traverse down and have counters for how many
times you've seen each one.  When you hit the bottom you discard the reconstructed
string if any counter is 0.
12:39 < vsmatck> I have no idea about complexity on that.  That's just a way
I thought it could be done.
12:41 < nsf> well, it's not the hard task yes
12:41 < nsf> the tricky part is to make it right
12:41 < nsf> and definition of "right" is fuzzy here too
12:42 < nsf> because it will work for a lot of cases
12:42 < nsf> but for some it will fail
12:42 < nsf> and it all depends on a particular case by case scenario
12:43 -!- mbohun [~mbohun@ppp115-156.static.internode.on.net] has quit [Quit:
Leaving]
12:43 < nsf> my idea is simple: less shifts you have == better
12:43 < nsf> consider this example:
12:44 < nsf> 1: abcde
12:44 < nsf> 2: acbde
12:44 < nsf> and the pattern is: acd
12:44 < nsf> in both cases you have 1 shift
12:44 < nsf> a>cd
12:44 < nsf> and ac>d
12:44 < vsmatck> hm, ya which do you favor.  When shifts are closer to
beginning or end?
12:44 < nsf> and here I'm preferring ac>d over a>cd
12:45 < nsf> yes
12:45 < nsf> I prefer those that are closer to beginning
12:45 < nsf> and basically that's the algo
12:45 < vsmatck> That does seem like it'd be preferable since english people
read left to right.
12:45 < nsf> yes
12:46 < nsf> I mean it's not like that exactly
12:46 < nsf> I prefer matches that are closer to the beginning
12:46 < nsf> therefore ac>d is better than a>cd
12:46 < nsf> because its matches are closer to the beginning
12:47 < nsf> the implementation of that is rather interesting :)
12:48 < nsf> but the problem arises here:
12:48 < nsf> what if I have
12:48 < nsf> 3: cacde
12:48 < nsf> it contains one shift
12:48 < nsf> >acd
12:48 < nsf> but no cuts :)
12:49 < nsf> should I prefer it over others?
12:49 < nsf> and there is no strict answer to that
12:49 < nsf> because sometimes you want cuts
12:49 < nsf> sometimes you don't
12:49 -!- virtualsue [~chatzilla@93-97-62-8.zone5.bethere.co.uk] has joined
#go-nuts
12:49 < nsf> so..  I simply discarding that kind of ranking
12:49 < nsf> (cuts)
12:49 < nsf> discard*
12:50 < nsf> other than that case it works pretty well
12:50 * vsmatck uses his mouse to select what files he wants.
12:50 < vsmatck> I feel primitive.
12:50 < vsmatck> heh
12:51 < nsf> :D
12:51 < nsf> a matter of habit
12:51 < nsf> I know few starcraft players that are very fast with their
mouse :)
12:51 -!- napsy [~luka@88.200.96.18] has quit [Ping timeout: 265 seconds]
12:52 < vsmatck> heh yeah.  I watch pro starcraft a lot.  It's pretty crazy
watching the first person views on top Korean players.
12:52 < vsmatck> 400+ APM with KB+mouse on some players.
12:53 < nsf> hehe, their keyboard action is more fun to watch than mouse
usually
12:53 < nsf> because mostly they use pretty high sensitivity
12:53 * vsmatck is ~170APM in games.
12:53 < nsf> it's pretty nice :)
12:53 < nsf> mine is far lower
12:53 < nsf> but I play mostly shooters these days
12:54 < vsmatck> yeah how much you need depends a lot on the game.  Or in
starcraft the race.  Protoss players can have low APM.
12:54 < nsf> yep
12:56 -!- yihuang [~yihuang@183.17.179.67] has joined #go-nuts
12:56 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
12:57 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
13:11 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
13:23 -!- Project_NAP [~Marvin@82.84.71.147] has quit [Read error: Connection
reset by peer]
13:40 < exch> Does anyone have experience with SGML DTD declarations?
Specifically the difference between a PUBLIC vs SYSTEM identifier?
13:41 < exch> There's doesn't really seem to be any conclusive documentation
as to the purpose of the SYSTEM identifier and when to use that one instead of a
PUBLIC one
13:42 -!- piyushmishra [~piyushmis@117.200.225.193] has quit [Ping timeout: 252
seconds]
13:45 -!- nsf [~nsf@jiss.convex.ru] has joined #go-nuts
13:47 -!- jhawk28 [~jhawk28@user-142gfte.cable.mindspring.com] has joined #go-nuts
13:47 -!- major_majors [~major_maj@c-68-40-195-246.hsd1.mi.comcast.net] has joined
#go-nuts
13:53 -!- nsf [~nsf@jiss.convex.ru] has quit [Quit: WeeChat 0.3.3]
13:58 -!- major_majors [~major_maj@c-68-40-195-246.hsd1.mi.comcast.net] has quit
[Quit: major_majors]
13:58 -!- piyushmishra [~piyushmis@117.200.226.254] has joined #go-nuts
14:12 -!- jhawk28 [~jhawk28@user-142gfte.cable.mindspring.com] has quit [Remote
host closed the connection]
14:14 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has joined
#go-nuts
14:14 -!- terrex [~terrex@84.122.67.111.dyn.user.ono.com] has quit [Quit:
Leaving.]
14:26 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has joined #go-nuts
14:28 -!- peterdn [~peterdn@host86-166-21-20.range86-166.btcentralplus.com] has
quit [Ping timeout: 240 seconds]
14:29 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has quit
[Ping timeout: 272 seconds]
14:29 -!- piyushmishra [~piyushmis@117.200.226.254] has quit [Ping timeout: 255
seconds]
14:30 -!- MorningSon [~MorningSo@cpe-72-177-219-41.satx.res.rr.com] has joined
#go-nuts
14:30 -!- zozoR [~zozoR@4705ds1-ris.0.fullrate.dk] has quit [Ping timeout: 240
seconds]
14:31 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has joined
#go-nuts
14:41 -!- emmanueloga [~emmanuelo@host52.190-30-10.telecom.net.ar] has quit [Ping
timeout: 240 seconds]
14:44 -!- piyushmishra [~piyushmis@117.200.225.129] has joined #go-nuts
14:44 -!- skejoe_ [~skejoe@188.114.142.231] has joined #go-nuts
14:47 -!- skejoe [~skejoe@188.114.142.231] has quit [Ping timeout: 276 seconds]
14:56 -!- peterdn [~peterdn@host86-166-21-60.range86-166.btcentralplus.com] has
joined #go-nuts
15:02 -!- jcao219 [~jcao219@pool-173-74-61-111.dllstx.fios.verizon.net] has joined
#go-nuts
15:03 -!- napsy [~luka@88.200.96.18] has quit [Ping timeout: 276 seconds]
15:03 -!- tav_ [~tav@92.7.77.8] has joined #go-nuts
15:03 -!- sacho [~sacho@213.91.244.15] has quit [Remote host closed the
connection]
15:05 -!- thomas_b_ [~thomasb@cm-84.215.47.51.getinternet.no] has quit [Quit:
leaving]
15:05 -!- tav [~tav@92.7.89.108] has quit [Ping timeout: 245 seconds]
15:09 -!- napsy [~luka@88.200.96.18] has joined #go-nuts
15:16 -!- tav [~tav@92.7.77.8] has quit [Read error: Connection reset by peer]
15:17 -!- tav [~tav@92.7.77.8] has joined #go-nuts
15:21 -!- skejoe [~skejoe@188.114.142.231] has joined #go-nuts
15:24 -!- skejoe_ [~skejoe@188.114.142.231] has quit [Ping timeout: 245 seconds]
15:28 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has joined #go-nuts
15:30 -!- ikaros [~ikaros@dslb-084-059-076-021.pools.arcor-ip.net] has joined
#go-nuts
15:33 -!- risent [~risent@ip-67-202-107-128.static.chi2.systeminplace.net] has
joined #go-nuts
15:35 -!- risent [~risent@ip-67-202-107-128.static.chi2.systeminplace.net] has
left #go-nuts []
15:37 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has joined #go-nuts
15:38 -!- bugQ [~bug@c-67-171-127-76.hsd1.ut.comcast.net] has quit [Remote host
closed the connection]
15:42 -!- emmanueloga [~emmanuelo@190.244.14.111] has joined #go-nuts
16:03 < exch>
http://stackoverflow.com/questions/652788/what-is-the-worst-real-world-macros-pre-processor-abuse-youve-ever-come-across/652945#652945
lol
16:07 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-172-36.clienti.tiscali.it] has
joined #go-nuts
16:08 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 272 seconds]
16:09 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
16:13 -!- Sh4pe [~Sh4pe@dslb-088-066-055-077.pools.arcor-ip.net] has joined
#go-nuts
16:13 < ProNihilist> exch: oh my
16:14 < exch> the comment on the first entry is priceless.  Particularly the
punishment bit ^^
16:22 -!- DerHorst [~Horst@e176098253.adsl.alicedsl.de] has quit [Remote host
closed the connection]
16:28 -!- jA_cOp_ [~yakobu@unaffiliated/ja-cop/x-9478493] has quit [Read error:
Connection reset by peer]
16:29 -!- femtoo [~femto@95-89-248-241-dynip.superkabel.de] has joined #go-nuts
16:35 < exch> Would reading from a global map (without a mutex) be
considered safe in a concurrent scenario?  There are no writes to it after it's
been created
16:40 -!- kashia_ [~Kashia@port-92-200-219-143.dynamic.qsc.de] has quit [Quit:
This computer has gone to sleep]
16:41 < cbeck> If it's read only, I can't see why not
16:45 -!- rejb [~rejb@unaffiliated/rejb] has quit [Ping timeout: 276 seconds]
16:47 -!- ExtraSpice [~XtraSpice@78-57-168-219.static.zebra.lt] has joined
#go-nuts
16:48 -!- skejoe_ [~skejoe@188.114.142.231] has joined #go-nuts
16:52 -!- skejoe [~skejoe@188.114.142.231] has quit [Ping timeout: 272 seconds]
16:52 -!- Ariato [Ariato@we.will.never-be.afraid.org] has joined #go-nuts
16:54 -!- Ariato [Ariato@we.will.never-be.afraid.org] has left #go-nuts []
17:03 -!- Shyde [~shyde@HSI-KBW-078-043-070-132.hsi4.kabel-badenwuerttemberg.de]
has quit [Remote host closed the connection]
17:03 -!- rejb [~rejb@unaffiliated/rejb] has joined #go-nuts
17:26 -!- bugQ [~bug@c-67-171-127-76.hsd1.ut.comcast.net] has joined #go-nuts
17:32 -!- yihuang [~yihuang@183.17.179.67] has quit [Quit: yihuang]
17:32 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has quit
[Ping timeout: 272 seconds]
17:33 -!- yihuang [~yihuang@183.17.179.67] has joined #go-nuts
17:41 < bfrank> if I hadn't programmed in c before, how would I know that
fmt.Scanf's second argument should be an address of a variable?
17:43 < exch> Presumably by reading the Go spec and realizing that using a
value which is modified inside a function is a bit pointless if you pass it as a
value parameter :)
17:44 < bfrank> that is not really a good answer, I mean it isn't very clear
about that from the spec that I see
17:45 < exch> it does state that everything except maps and slices are
passed by value.  Unless you explicitely turn it into a pointer
17:46 < exch> technically the maps and slices are also by value.  it just
indicates you can modify the underlying data of a map/slice without a problem.
Not the actual map/slice itself
17:47 < bfrank> if the intention is to have the language be easy to use, you
would think that it would do the right thing, so if I pass a variable to scanf,
instead of the address, you would think the language would know that I meant for
it to use the address.  Otherwise, what is the point of passing the variable's
value and not having it work properly?  When would I ever want it to do that?
17:50 < exch> That implies the compiler actually understands the context of
a function you write.  In some cases I do modify the value of a parameter inside a
function, eventhough it is not going to persist outside the function, just so I
can save having to allocate a new variable for something
17:50 < exch> the compiler can't tell the difference in what I intend for it
to mean
17:52 < bfrank> if you do want to modify the value of a parameter inside a
function and not have it affect the original, shouldn't the function be making a
localized copy that isn't seen outside the function?
17:52 -!- yihuang [~yihuang@183.17.179.67] has quit [Remote host closed the
connection]
17:52 < exch> yes, you do that by not passing it as a pointer
17:52 < bfrank> garabage collection should alleviate any concerns of
allocating a new variable
17:52 -!- Ariato [Ariato@we.will.never-be.afraid.org] has joined #go-nuts
17:53 < Ariato> what gui frameworks are for go besides gtk?
17:53 < bfrank> hmm, I guess maybe with time the docs will get better and
more explicit
17:54 < exch> Ariato: apart from a straight up Xlib/XCB library, I don't
think there are any yet
17:55 < Ariato> exch youre still here lol
17:55 < exch> I am :p
17:55 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 272 seconds]
17:56 < Ariato> what have i missed the last 1/2 year?  anything new?
17:56 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
17:57 < exch> A bunch of changes in the language.  Package additions, etc
17:57 -!- bugQ [~bug@c-67-171-127-76.hsd1.ut.comcast.net] has quit [Quit: but
don't be sad.]
17:57 < Ariato> any big app yet?
17:58 < exch> I suppose that depends on how you define 'big'.  I don't
really keep up with everybody's work though.  I just see what's posted in the
mailinglist
17:59 < Ariato> ok any gui app?  :p
17:59 < exch> I haven't seen any yet
18:00 < exch> Though I have my hands full with a full validating sgml parser
atm.  It strains my brain capacity to the point where I'm oblivious to everything
else :p
18:00 < Ariato> hahah
18:02 -!- piyushmishra [~piyushmis@117.200.225.129] has quit [Ping timeout: 272
seconds]
18:03 < Ariato> is a program compiled with gccgo faster than the one
compiled with g6/g8?
18:04 < exch> It used to be.  I'm not sure if that's still the case.  A lot
of work has been done on the Xg/Xl bits in the past months.  I also never used
gccgo myself
18:04 < Ariato> oh i see
18:05 < Ariato> timmy right?
18:05 < exch> timmy?
18:05 < Ariato> damn it
18:05 < Ariato> i thought that was you
18:05 < Ariato> or smth like that
18:05 < exch> heh nope
18:05 < Ariato> i used to hang around here when go came out with XniX23 nick
18:06 < exch> That sounds vaguely familiar
18:06 < Ariato> yes, you loved me
18:06 < Ariato> ;D
18:06 < exch> lol If you say so :)
18:14 -!- femtoo [~femto@95-89-248-241-dynip.superkabel.de] has quit [Ping
timeout: 252 seconds]
18:16 -!- piyushmishra [~piyushmis@117.200.226.116] has joined #go-nuts
18:18 -!- Sh4pe [~Sh4pe@dslb-088-066-055-077.pools.arcor-ip.net] has quit [Quit:
Sh4pe]
18:20 -!- gabriel9 [~gabriel9@93.157.192.28] has quit [Remote host closed the
connection]
18:22 -!- femtoo [~femto@95-89-248-241-dynip.superkabel.de] has joined #go-nuts
18:22 -!- gabriel9 [~gabriel9@93.157.192.28] has joined #go-nuts
18:32 -!- voker57 [~voker57@kvirc/developer/Voker57] has quit [Read error:
Connection reset by peer]
18:54 -!- tux21b [~christoph@90.146.60.30] has joined #go-nuts
18:54 -!- skejoe_ [~skejoe@188.114.142.231] has quit [Ping timeout: 265 seconds]
18:56 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has joined #go-nuts
18:56 -!- skejoe [~skejoe@188.114.142.231] has joined #go-nuts
19:00 -!- drhodes [~none@207.3.149.84] has quit [Quit: Lost terminal]
19:18 -!- jackman_ [~jackman@c-71-56-158-131.hsd1.wa.comcast.net] has quit [Ping
timeout: 272 seconds]
19:22 < napsy> khm ...  gccgo is broken
19:25 -!- jackman [~jackman@c-71-56-158-131.hsd1.wa.comcast.net] has joined
#go-nuts
19:33 -!- itrekkie [~itrekkie@ip72-200-111-9.tc.ph.cox.net] has joined #go-nuts
19:54 < exch> pfff..  Here I am parsing .dtd files..  turning them into
object structures of entity/element/attribute definitions with which I will later
validate sgml markup.  And then it hits me that this DTD stuff is all remarkably
similar to regular expressions.  SO instead of a DTD object tree I turn the DTD
code into a regex-like program and yank the sgml markup through it for validation
19:56 < exch> Considering the abysmal lack of (useful) documentation
regarding DTDs, this is a pretty damn brilliant revalation if I say so myself :)
19:58 < Tv> exch: you'd be way way better off sticking to xml, you know..
sgml is crazy insane special cases
19:58 < exch> xml is a variety of sgml.  By 'sgml' I mean all derivatives :)
19:58 < Tv> hah
19:58 < exch> including html/xml/svg
19:59 < Tv> look similar, but completely different under the hood
19:59 < Tv> trying to parse one with the toolchain of another is bound to
fial
20:00 < exch> That's what I thought when I started this, but having been
kneedeep in spec-hell, I've discovered it's not really all that difficult to
distinguish one from the other.  Of course there will always be version specific
little gremlins hiding in the grass, but are easy to account for manually
20:01 -!- aho [~nya@fuld-4d00d71b.pool.mediaWays.net] has joined #go-nuts
20:01 < exch> So far I've gotten pretty solid results from various types of
input: xml, html2, html3, xhtml, svg and a bunch of real world stuff from the web
that can't be classified at all
20:06 < cbeck> http://code.google.com/p/sre2/ - RE2 lib in the works
20:07 < cbeck> Hopefully it's fully functional soon, regexp makes me want to
tear my hair out sometimes
20:07 < exch> that will likely be useful to see how to go about a solid
regex implementation.  I doubt I can retrofit this parser to use an actual regexp
engine though.  It needs constructs strictly related to DTDs and schemas
20:08 < exch> Which likely makes it a fair bit les complex than something
like RE2 as well
20:08 < cbeck> Isn't sgml context free anyway?
20:09 < exch> There are rules to which it must adhere.  And rules can be
enforced :)
20:09 < exch> But yes, the level of enforcement depends on the
implementation..  they will be different for html4 as opposed to xml
20:09 < cbeck> Sure, but if it's context free, then parsing with a regex is
impossible
20:09 < cbeck> at least generally
20:11 -!- teop [~teop@78.138.171.130] has joined #go-nuts
20:11 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has quit [Ping
timeout: 245 seconds]
20:12 -!- [Pete_27] [~noname@110-174-103-31.static.tpgi.com.au] has joined
#go-nuts
20:12 < Gertm> I've been reading up on go a bit, and I was wondering why the
makers decided to still use pointers.  There has to be a good reason, right?
20:14 < exch> As opposed to just passing everything by reference as a
default?
20:14 < Gertm> yeah
20:14 < exch> Not sure really
20:14 -!- terrex [~terrex@84.122.67.111.dyn.user.ono.com] has joined #go-nuts
20:14 < Gertm> It's not that I mind they're there, I'm just curious why
they're explicit.
20:15 < cbeck> I think to allow you to *not* use them in places
20:15 < Tv> Gertm: probably comes down to them wanting Go to be low-level
enough to work for true systems development
20:16 < Tv> personally, i always end up trying to have var foo struct
something and setting foo to nil
20:16 -!- CharlesDM [De@43.137-244-81.adsl-dyn.isp.belgacom.be] has joined
#go-nuts
20:20 < Namegduf> Speed.
20:20 < Namegduf> Using references for everything is slow.
20:21 < Namegduf> References are also the same size or larger than many
primitive types.
20:21 < Namegduf> So memory usage suffers.
20:21 < exch> I suppose pointer dereferencing has a cost that can sometimes
be worse than the alternative
20:21 < Namegduf> The alternative being "have explicit pointers", yeah.
20:22 < exch> I'm a bit fuzzy on the difference between a reference and a
pointer though.  To my brain that sounds like the same thing
20:22 < Namegduf> They are the same thing.
20:22 < exch> why does c++ make a distinction there then?  Or have I
misunderstood something there?
20:23 < Namegduf> C++ references are non-nil, const pointers, which are used
syntactically as if they weren't pointers.
20:23 < exch> ah
20:23 < Namegduf> Const in that they always refer to the same thing.
20:24 < exch> basically a protection layer ontop of a standard pointer
20:24 < Namegduf> Having every type be used as a pointer to that type also
means you can't really write good cache-conscious algorithms, and your code will
have potentially many cache misses.
20:24 < Namegduf> In most code, that doesn't matter, but the
actually-where-the-CPU-time-is-used inner loops suffer as much as everything else.
20:25 < exch> hmm.  SOunds like I have a lot to learn in that respect.  I
never really considered any of that sort of stuff
20:25 < exch> I should prolly do some reading on the subject
20:25 < Gertm> Having coded almost no C++ before, I feel a bit set back when
learning Go. It's the first lower-level language I'm learning...  Should I know
C/C++ ?
20:26 < Namegduf> I would suggest starting with Go rather than those.
You'll need to learn some lower level things, but learning them with Go is no
harder.
20:26 < cbeck> You should probably learn them at some point, but there's no
need to do so prior to learning Go
20:26 < cbeck> And the syntax is way more friendly
20:28 < Gertm> Well I do C# for a living, and toying with functional
languages in my spare time.  Go seems like a nice addition to my languages
collection.
20:28 < exch> Gertm: I came from 10 years of C# myself
20:28 < Gertm> exch: so what are your impressions so far?
20:28 < exch> Sporadic use of C inbetween, but not enough to get me familiar
with all the low level dirt
20:28 -!- cco3 [~conley@c-69-181-138-209.hsd1.ca.comcast.net] has quit [Ping
timeout: 255 seconds]
20:28 < exch> Gertm: I left C# behind.  That should tell you all :)
20:29 < Gertm> hmm nice
20:29 < exch> Eventhough Go is still in development.  It's already worth the
switch and it can only get better
20:29 < Gertm> I'm printing the language spec, going to start with that.
20:29 < exch> The only thing I miss is the immense standard library.  But
that's just a matter of time for Go
20:29 < Gertm> yeah, .NET is kinda nice for that
20:30 < Gertm> But from what I've seen so far from browsing through the
packages, Go has everything I want/need already in the standard packages.
20:32 -!- virtualsue [~chatzilla@93-97-62-8.zone5.bethere.co.uk] has quit [Ping
timeout: 272 seconds]
20:44 -!- Ariato [Ariato@we.will.never-be.afraid.org] has quit [Read error:
Connection reset by peer]
20:44 -!- HollyRain [~HollyRain@212.106.246.8] has joined #go-nuts
20:45 < HollyRain> hi!  I've several functions that do the same except for a
little code which is different for each one of them
20:46 < HollyRain> could be created another functions with the different
code and then call them from the main function?
20:47 < HollyRain> func common(a string, func different())
20:48 < exch> func common(a string, different func())
20:48 -!- devink [~devin@c-76-24-8-98.hsd1.ma.comcast.net] has joined #go-nuts
20:49 < exch> or if 'different' needs parameters and/or a return value: func
common(a string, different func(string) int)
20:49 -!- alkavan [~alkavan@IGLD-84-228-162-5.inter.net.il] has joined #go-nuts
20:50 -!- piyushmishra [~piyushmis@117.200.226.116] has quit [Ping timeout: 276
seconds]
20:51 < HollyRain> exch: and if the func has different parameters?  because
I've to pass it different types
20:51 < HollyRain> I refer to the different func.
20:51 < HollyRain> could be solved using an interface?
20:52 < exch> probably, yes
20:52 < HollyRain> ok, thanks
21:01 -!- rlab [~Miranda@91.200.158.34] has quit [Quit: Miranda IM! Smaller,
Faster, Easier.  http://miranda-im.org]
21:09 -!- dcat [~dcat@ip70-188-19-141.rn.hr.cox.net] has left #go-nuts ["Leaving"]
21:14 -!- Malatesa [43bbea18@gateway/web/freenode/ip.67.187.234.24] has joined
#go-nuts
21:15 < exch> http://pastebin.com/Vqu4npZN How is it that struct B still
qualifies as interface Object, eventhough it's initialized as a pointer but the
function receiver is a value?
21:15 < exch> If you do it the other way around (pointer receiver, but value
declaration), the compiler fails
21:15 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has joined
#go-nuts
21:20 < yiyus> exch: from the spec: The method set of the corresponding
pointer type *T is the set of all methods with receiver *T or T (that is, it also
contains the method set of T)
21:20 < exch> hmm
21:20 -!- alkavan [~alkavan@IGLD-84-228-162-5.inter.net.il] has quit [Quit:
Leaving]
21:20 -!- janm [~jmalonzo@ppp121-44-224-98.lns20.syd7.internode.on.net] has quit
[Ping timeout: 245 seconds]
21:21 < exch> It's a bit confusing that this only goes for a *T and not for
T
21:21 -!- janm [~jmalonzo@ppp121-44-166-130.lns20.syd7.internode.on.net] has
joined #go-nuts
21:22 -!- Fish [~Fish@bus77-2-82-244-150-190.fbx.proxad.net] has quit [Remote host
closed the connection]
21:23 < yiyus> exch: what do you mean?
21:24 < exch> a vaiable declared as *T will always satisfy an interface,
regardless of whether the functions have pointer receivers or not.  But if the
variable is declared as T, it will only consider the functions with T receivers
21:24 < Namegduf> Thre's good reason for it.
21:24 < Namegduf> Methods on T can work on *T by automatic dereferencing.
21:25 < Namegduf> Well, better way to put it.
21:25 < Namegduf> Parameters expecting T can work on *T by automatic
dereferencing.
21:25 < Namegduf> But parameters expecting *T can't work on T by getting an
automatic pointer, because T has already been copied.
21:26 < Namegduf> So you don't get pass-by-reference semantics.
21:26 < exch> hmm
21:26 -!- scarabx [~scarabx@c-76-19-43-200.hsd1.ma.comcast.net] has quit [Quit:
This computer has gone to sleep]
21:27 < Namegduf> This means that mutator methods will work on a copy.
21:27 < Namegduf> Which is almost certainly not what is wanted.
21:27 < Namegduf> You could make interfaces containing them *seem* to work,
but they wouldn't actually do what was wanted.
21:30 < exch> If I understand this correctly, neither of the 'this.name =
name' assignments in either struct A or B will survive after the SetName() call,
eventhough B is passed as a pointer receiver initially (the runtime will
dereference it and make a copy)
21:31 < Namegduf> If it's a method on the struct, not a pointer to the
struct, yeah.
21:31 < Namegduf> Receivers behave exactly like parameters do.
21:32 < exch> right, that clears things up a bit
21:33 < exch> I was beginning to fear I lost my mind there for a sec
21:34 -!- skejoe [~skejoe@188.114.142.231] has quit [Quit: Lost terminal]
21:34 -!- cco3 [~conley@205.248.100.252] has joined #go-nuts
21:45 -!- niemeyer [~niemeyer@201-35-72-214.pltce701.dsl.brasiltelecom.net.br] has
joined #go-nuts
21:46 < Tv> exch: absence of evidence is not evidence of absence ;)
22:01 -!- awidegreen [~quassel@62.176.237.78] has quit [Read error: Connection
reset by peer]
22:01 -!- gabriel9 [~gabriel9@93.157.192.28] has quit [Ping timeout: 265 seconds]
22:02 -!- luruke [~luruke@151.53.42.188] has joined #go-nuts
22:05 < napsy> ok a silly question, how do I concatenate uint8 to a string?
mystr += ch doesn't seem to work
22:07 < Tv> napsy: tried mystr += string(ch) ?
22:07 < napsy> oops, totally forgot
22:07 < napsy> tn
22:07 < napsy> x
22:08 < exch> strings are immutable.  Modifying them wih + or += is a
timeconsuming and expensive process.  You're better off using a bytes.Buffer to
build a string.  It allows writing of strings, byte slices and individual bytes or
unicode runes
22:08 < exch> granted though, if it's a single concatenation somewhere in
the code, it probably won't matter much
22:08 < napsy> ok
22:10 -!- Chryson [~Chryson@c-71-61-11-114.hsd1.pa.comcast.net] has joined
#go-nuts
22:10 < HollyRain> exch: and what about use fmt.Sprintf ?
22:11 < exch> I think it uses a bytes.Buffer internally
22:11 < exch> Not sure though.  I'd have to check the source
22:11 -!- tvw [~tv@e176001204.adsl.alicedsl.de] has joined #go-nuts
22:14 -!- niemeyer [~niemeyer@201-35-72-214.pltce701.dsl.brasiltelecom.net.br] has
quit [Ping timeout: 245 seconds]
22:21 -!- Project_2501 [~Marvin@dynamic-adsl-94-36-172-36.clienti.tiscali.it] has
quit [Quit: E se abbasso questa leva che succ...]
22:23 -!- Malatesa [43bbea18@gateway/web/freenode/ip.67.187.234.24] has quit
[Quit: Page closed]
22:25 -!- tvw [~tv@e176001204.adsl.alicedsl.de] has quit [Ping timeout: 245
seconds]
22:34 -!- femtoo [~femto@95-89-248-241-dynip.superkabel.de] has quit [Quit:
Leaving]
22:41 -!- ikaros [~ikaros@dslb-084-059-076-021.pools.arcor-ip.net] has quit [Quit:
Leave the magic to Houdini]
22:42 -!- ShadowIce` [pyoro@unaffiliated/shadowice-x841044] has quit [Quit:
Verlassend]
22:54 -!- CharlesDM [De@43.137-244-81.adsl-dyn.isp.belgacom.be] has quit []
22:56 -!- luruke [~luruke@151.53.42.188] has quit [Quit: Leaving]
22:58 -!- HollyRain [~HollyRain@212.106.246.8] has left #go-nuts []
22:59 -!- itrekkie [~itrekkie@ip72-200-111-9.tc.ph.cox.net] has quit [Quit:
itrekkie]
23:00 -!- terrex [~terrex@84.122.67.111.dyn.user.ono.com] has quit [Quit:
Leaving.]
23:04 -!- tensorpudding [~user@99.23.122.78] has joined #go-nuts
23:06 -!- gabriel9 [~gabriel9@93.157.192.28] has joined #go-nuts
23:30 -!- photron [~photron@port-92-201-57-106.dynamic.qsc.de] has quit [Ping
timeout: 252 seconds]
23:47 -!- powerje [~powerje@adsl-75-49-12-108.dsl.wotnoh.sbcglobal.net] has joined
#go-nuts
23:53 -!- Sh4pe [~Sh4pe@dslb-088-066-055-077.pools.arcor-ip.net] has joined
#go-nuts
--- Log closed Sun Sep 19 00:00:07 2010