--- Log opened Tue Nov 24 00:00:30 2009
01:59 -!- mode/#go-run [+o Gracenotes] by ChanServ
01:59 -!- mode/#go-run [+v rndbot] by Gracenotes
01:59 -!- mode/#go-run [-o Gracenotes] by Gracenotes
01:59 -!- alc [n=alc@114.245.254.17] has joined #go-run
02:00 -!- Ycros [n=ycros@211.30.206.246] has joined #go-run
02:00 -!- jordyd [n=jordyd@99-177-65-75.lightspeed.wepbfl.sbcglobal.net] has
joined #go-run
02:01 -!- Ibw [n=isaac@cpe-67-241-42-134.twcny.res.rr.com] has joined #go-run
02:03 -!- Ibw [n=isaac@cpe-67-241-42-134.twcny.res.rr.com] has left #go-run
["Konversation terminated!"]
02:03 < Ycros> Gracenotes: so are we allowed to test for vulnrabilities?  :P
02:04 < alc> > i, j := 0, 1; for { fmt.Printf("%d ", i); tmp := j; j =
i+j; i=tmp; }
02:04 <+rndbot> 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584
4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 8...
02:05 < Ycros> neat
02:06 < alc> > i, j := 0, 1; for { fmt.Printf("%d ", i); i, j = j, i + j;
}
02:06 <+rndbot> 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584
4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 8...
02:08 < alc> comma style helps avoid tmp :)
02:10 < alc> > for i, j := 0, 1;; i, j = j, i + j { fmt.Printf("%d ", i);
}
02:10 <+rndbot> 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584
4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 8...
02:13 < reppie> f = 1 : 1 : zipWith (+) f (tail f)
02:14 < alc> =)
02:14 < ehird> > syscall
02:14 <+rndbot> <Error: undefined: syscall>
02:14 < alc> haskell more elegant
02:14 < ehird> #haskell→
02:21 < Gracenotes> Ycros: back!  go ahead
02:22 < Gracenotes> I do agree that 'Haskell more elegant' :)
02:22 < ehird> *haskell
02:22 < Gracenotes> alc: ooh, forgot about the comma style swapping.  I'll
edit the topic in a bit
02:23 < ehird> He said "haskell more elegant"!
02:23 < Gracenotes> human strings are case-insensitive-initial
02:23 < Gracenotes> ..in some cases
02:24 < ehird> Well, it certainly isn't an English string, so...
02:26 < Ycros> I was wondering what it would be like if Go had syntactic
sugar for monads like Haskell
02:27 < Ycros> you could take exp/excption and make it a lot nicer to use
across function calls
02:28 < Ycros> oo, I think I just thought of an alternate solution
02:30 < Gracenotes> I thought about passing in err to chained calls, like a
strict Maybe monad.  (okay, analogy doesn't completely hold)
02:31 < Gracenotes> I decided against it because it doesn't seem like as
sensible a convention for Go
02:31 < Ycros> but yeah, if we had sugar for monads, we could abstract stuff
like the error handling
02:31 < Ycros> though, one thing I HATE about Haskell, is that there is no
consistent way of error handling
02:31 < Ycros> everyone seems to do it differently
02:32 < Ycros>
http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors
<--- this
02:34 < ehird> I disagree with 1, it is not the most common way, and it is
bad; 2 and 3 (with an error type instead of String) are basically equivalent and
both Good; 4 is useful in a monadic situation; 5 is useful if maybe/either seems
out of place (e.g.  Parsec).
02:34 < ehird> That's my analysis.
02:34 < ehird> I don't think it's really that inconsistent.
02:44 -!- ehird [n=ehird@91.105.114.252] has quit []
02:48 < Ycros> > import ("vector")
02:48 <+rndbot> <Error: syntax error near import>
02:48 < Ycros> Gracenotes: is it pre-imported stuff?
02:48 < Ycros> Gracenotes: or does it import when you try to use something?
02:48 < Ycros> > vector.NewVector(0)
02:48 <+rndbot> <Error: undefined: vector.NewVector>
02:49 < Gracenotes> Ycros: http://gopaste.org/view/C8l0w <- feel free to
pick it apart :)
02:49 < Gracenotes> the more vulnerabilities found, the better
02:50 < Ycros> mmmk
02:50 < Gracenotes> yeah, it does have a pre-imported list
02:51 < Gracenotes> the current list is (separated by newlines): big bignum
bytes container/heap container/list container/ring container/vector crypto/md5
encoding/base64 encoding/binary encoding/hex flag fmt go/parser go/ast go/printer
io os math path rand regexp strings sync strconv sort time
02:51 < Ycros> mmk
02:51 < Gracenotes> io and os are modified in their source to be less
tricky.  just for now.
02:51 < Gracenotes> > os.Mkdir("test")
02:51 <+rndbot> <Error: not enough arguments to CALL>
02:51 < Gracenotes> @eval os.Rmdir("test")
02:51 <+rndbot> <Error: undefined: os.Rmdir>
02:52 < Gracenotes> @eval os.Remove("grrrrr")
02:52 <+rndbot> os.Remove not allowed
02:52 < Gracenotes> ah, Mkdir requires a permission argument
02:52 < Ycros> > go func() { fmt.Print("hi") }()
02:52 <+rndbot> <no output>
02:52 < Ycros> @eval go func() { fmt.Print("hi") }()
02:52 <+rndbot> <Error: syntax error near go>
02:54 < Ycros> what was the difference between eval and > ?
02:54 < Gracenotes> there are currently 3 commands.  @eval, @main, and >.
The latter two do the same thing, for now
02:54 < Gracenotes> eval, as you can see in the paste, wraps the result in
fmt.Print, and passes it to main
02:54 < Ycros> @eval 1+1
02:54 <+rndbot> 2
02:54 < Ycros> mmk
02:55 < Gracenotes> as I mentioned in #go-nuts, I'll probably end up
checking if the thing after '>' parses to an expression-statement, and if
that's the case, treat it as an @eval call, and a @main call otherwise
02:55 < Ycros> > 1+1
02:55 <+rndbot> <Error: 2 not used, 2 not used>
02:55 < Ycros> > fmt.Print(1+1)
02:55 <+rndbot> 2
02:56 < Gracenotes> hmm
02:56 < Gracenotes> > } func main() {
02:56 <+rndbot> <Error: main redeclared in this block, declaration at
/tmp/yborqnvemyjnydsxgen.go:3>
02:56 < Gracenotes> heh.  that's one "vulnerability", but it fails to
compile anyway, so it's not dangerous :)
02:57 < Gracenotes> it checks for functions not named main
02:57 < Gracenotes> > } func test() {
02:57 <+rndbot> <Error: Statements not contained>
02:57 < Gracenotes> I'll just check for main once, then
02:59 -!- jordyd [n=jordyd@99-177-65-75.lightspeed.wepbfl.sbcglobal.net] has quit
["Leaving"]
03:00 < Ycros> > f(); }; import("unsafe"); func f() {
fmt.Print(unsafe.Sizeof(2));
03:00 <+rndbot> <Error: syntax error near import>
03:00 < Ycros> > f(); }; import "unsafe"; func f() {
fmt.Print(unsafe.Sizeof(2));
03:00 <+rndbot> <Error: syntax error near import>
03:01 < Ycros> is that only valid at the top then?
03:01 < Ycros> hmm
03:01 < Gracenotes> yeah
03:02 < Gracenotes> that is one reason I allow free copy+paste with little
modification otherwise
03:03 < Gracenotes> pastebin has the checks
03:35 < alc> > a:=0; a++
03:36 < alc> @eval a:=0
03:40 < alc> Gracenotes: checking if the thing after '>' parses to an
expression-statement <-- "exp/eval" might help
03:40 -!- Gracenotes_ [n=person@wikipedia/Gracenotes] has joined #go-run
03:42 -!- rndbot [n=bot@wikipedia/Gracenotes] has quit [Nick collision from
services.]
03:42 -!- Gracenotes [n=person@wikipedia/Gracenotes] has quit [Nick collision from
services.]
03:43 < Gracenotes> okay, the dynamic ghost we were on decided to change its
IP. sorry about that -.-
03:44 < Gracenotes> dynamic host, I mean.  heh.
03:44 < Gracenotes> access to said host graciously given to me by another
freenoder so I could access IRC in the first place
03:44 -!- rndbot [n=bot@wikipedia/Gracenotes] has joined #go-run
03:45 < Gracenotes> hm.  should have take that opportunity to pull and
recompile.  anyway, *keeps working on feature stuff*
04:18 < uriel> Gracenotes: did you upload rndbot's code somewhere?
04:19 < Gracenotes> uriel: here is the module-running code, at this point.
http://gopaste.org/view/C8l0w Again, both this and the IRC library are a work in
progress..  and I should get a damn github account -.-
04:22 < uriel> :)
04:22 < uriel> use code.google.com
04:22 < uriel> (nothing against github, but makes more sense to me for Go
projects, but that is just a matter of taste)
04:23 < Gracenotes> ah.  good point.  you can just sign up for a project
instantaneously?
05:13 < alc> "exp/eval" has handy Compile() and Run()
05:15 < Gracenotes> alc: what does?
05:16 < Gracenotes> oh, the package
05:16 < alc> checking if the thing after '>' parses to an
expression-statement
05:16 < Gracenotes> the parser handles that just fine
05:19 < Gracenotes> it's as simple as finding the FuncDecl containing main
and seeing that the length of its body is 1, and that the type of statement
therein is an ExprStmt
05:19 < alc> > 1+1
05:19 < rndbot> <Error: 2 not used, 2 not used>
05:19 < Gracenotes> ...something like that :)
05:23 < alc> exp/eval much simpler for it
05:23 < alc> Compile() can directly compile string
05:23 < Gracenotes> to an ELF file?
05:23 < Gracenotes> if not, then it's not good enough
05:23 < Gracenotes> at least for the main functionality..  there could be a
separate interpreter command
05:23 < alc> i.e.  > 1+1 -- you can pass "1+1" to it and if later Run()
successfully returns a non-nil value, then it's a single expression
05:23 < Gracenotes> :/ and what will it say about "for {}"?
05:25 < Gracenotes> it's an interesting idea for running, but for
verification, it is less optimal
05:25 < alc> http://golang.org/pkg/exp/eval/
05:26 < alc> "for {}" compiles, but Run() returns nil, since its not a
single expression
05:26 < alc> oh, just an idea
05:26 < alc> thought this way is easier (ie.  less code..)
05:28 < Gracenotes> ah, I see :) I will probably need the parse tree anyway
for other checks, so, kill two or two or four birds with one stone
05:28 < alc> hence "go nuts!"
05:29 < alc> :p
05:29 < Gracenotes> :S
07:35 -!- mode/#go-run [+o Gracenotes] by ChanServ
07:36 -!- Gracenotes changed the topic of #go-run to: rndbot runs Go statements
placed in a main method | fibonacci: > i, j := 0, 1; for { fmt.Printf("%d ",
i); i, j = j, i + j; } | expressions: @eval 2+2 | rndbot's module for evaluating
code: http://gopaste.org/view/C8l0w
07:36 -!- mode/#go-run [+v rndbot] by Gracenotes
07:36 -!- mode/#go-run [-o Gracenotes] by Gracenotes
08:04 < alc> > func f(a int, b int) (c int) {c = a + b}; println(f(1,2))
08:04 <+rndbot> <Error: syntax error near f>
08:08 < alc> > func f(a int, b int) (c int) {c = a + b; return c};
println(f(1,2))
08:08 <+rndbot> <Error: syntax error near f, syntax error near
println>
08:10 < alc> > f := func (a int, b int) (c int) {c = a + b; return };
println(f(1,2))
08:10 <+rndbot> 3
08:16 < alc> > adder := func ()(func(int) int) {var x int; return func
(delta int) int { x += delta; return x} }; var f = adder(); print(f(1));
print(f(20)); print(f(300));
08:16 <+rndbot> 121321
08:16 < alc> > adder := func ()(func(int) int) {var x int; return func
(delta int) int { x += delta; return x} }; var f = adder(); println(f(1));
println(f(20)); println(f(300));
08:16 <+rndbot> 1 21 321
09:02 < alc> > type Point struct {x, y int}; var p = Point {1,2};
println(p.x);
09:02 <+rndbot> 1
09:03 < alc> > type Point struct {x, y int}; p := Point {1,2};
println(p.x);
09:03 <+rndbot> 1
09:04 < alc> > type Point struct {x, y int}; var Point {1,2};
println(p.x);
09:04 <+rndbot> <Error: syntax error near Point, empty top-level
declaration>
09:04 < alc> > type Point struct {x, y int}; var p Point {1,2};
println(p.x);
09:04 <+rndbot> <Error: syntax error near Point, empty top-level
declaration>
09:04 < alc> > var p int = 3; print(p)
09:05 <+rndbot> 3
14:38 -!- alc [n=alc@114.245.254.17] has quit [Read error: 60 (Operation timed
out)]
15:05 -!- Nanoo [n=Nano@95.89.197.169] has joined #go-run
15:05 -!- Nanoo [n=Nano@95.89.197.169] has left #go-run ["Leaving"]
16:56 -!- XniX23 [n=XniX23@89-212-10-29.dynamic.dsl.t-2.net] has joined #go-run
16:58 -!- XniX23 [n=XniX23@89-212-10-29.dynamic.dsl.t-2.net] has quit [Remote
closed the connection]
17:00 -!- rbohn [n=rbohn@192.206.100.4] has joined #go-run
17:04 < rbohn> #eval new([12]int)
17:04 < rbohn> @eval new([12]int)
17:04 <+rndbot> &[0 0 0 0 0 0 0 0 0 0 0 0]
17:05 < rbohn> for t := range new([12]int) {fmt.Println(12-t)}
17:05 < rbohn> > for t := range new([12]int) {fmt.Println(12-t)}
17:05 <+rndbot> <Error: cannot range over new([12]int) (type *[12]int),
fatal error: typecheck loop>
17:06 < rbohn> > for t := range &new([12]int) {fmt.Println(12-t)}
17:06 <+rndbot> <Error: cannot take the address of new([12]int), cannot
range over &new([12]int) (type **[12]int), fatal error: typecheck loop>
17:06 < rbohn> > for t := range *new([12]int) {fmt.Println(12-t)}
17:06 <+rndbot> 12 11 10 9 8 7 6 5 4 3 2 1
17:10 < rbohn> @eval [12]int{}
17:10 <+rndbot> [0 0 0 0 0 0 0 0 0 0 0 0]
17:12 < exch> probably better to allocate something smaller than integers.
the actual values don't matter in this case
17:21 < rbohn> How big is an int?  I guess byte is smallest storage type?
17:22 < exch> not sure if 'int' maps to the platform standard..  so 32 bits
or 64, depending on architecture.
17:22 < exch> int32 and int64 are more specific
17:22 < exch> byte is 8 bits
17:23 < exch> a bool could be smaller.  Not sure how big it is really.
17:24 < rbohn> @eval int(0x8000000000000000)
17:24 <+rndbot> <Error: constant 9223372036854775808 overflows int>
17:24 < exch> > b := true; println(unsafe.Sizeof(b))
17:24 <+rndbot> <Error: undefined: unsafe>
17:24 < exch> aww
17:24 < rbohn> yeah, unsafe isn't imported...
17:25 < rbohn> @eval int(0x80000000)
17:25 <+rndbot> <Error: constant 2147483648 overflows int>
17:25 < rbohn> @eval int(0x7FFFFFFF)
17:25 <+rndbot> 2147483647
17:25 < exch> looks like byte and bool are both the same size
17:26 < rbohn> There must be some maxint type constant out there.
17:26 < rbohn> hmm
17:27 < rbohn> I think range "googlegoogle" is still most fun way.
17:27 < exch> heh
17:29 < exch> mm.  int is 4 bytes (32 bits), even on a 64 bit system
17:29 < exch> wonder why we don't have a 'long' type then
17:30 < exch> > println( int(3) + int64(3))
17:30 <+rndbot> <Error: invalid operation: 3 + 3 (type int + int64)>
17:30 < exch> ><
17:31 < exch> > println( int(3) + int32(3))
17:31 <+rndbot> <Error: invalid operation: 3 + 3 (type int + int32)>
17:31 < exch> @eval 1/0
17:31 <+rndbot> <Error: division by zero>
18:06 < Gracenotes> > x := rand.Int(); if x > 1 {x = 0}; print(1/x)
18:06 <+rndbot> SIGFPE: floating-point exception Faulting address: 0x8048849
PC=0x8048849 main·main+0x49 /tmp/hcytnvurmgmcbewvgen.go:4 main·...
18:07 < Gracenotes> all <Error: x>s mean it did not run
18:08 < Gracenotes> hm.  floating point, huh.
18:09 < Gracenotes> > var x float64 = 0.0; print(1.0/x)
18:09 <+rndbot> +Inf
18:09 < Gracenotes> > print(1.0/float64(0.0))
18:09 <+rndbot> <Error: division by zero>
18:09 < Gracenotes> that is too weird..
18:10 < Gracenotes> a bug, even
18:13 < Gracenotes> anyhow, I am working through the logic of interface
implementation.  thankfully the specification seems to be thorough, but the
important information is scattered in bits and pieces
19:13 -!- p4p4 [n=P4p4@24.106.113.82.net.de.o2.com] has joined #go-run
19:42 -!- mode/#go-run [+o Gracenotes] by ChanServ
19:42 -!- Gracenotes changed the topic of #go-run to: rndbot runs Go statements
placed in a main method | fibonacci: > i, j := 0, 1; for { fmt.Printf("%d ",
i); i, j = j, i + j; } | expressions: @eval 2+2 | rndbot's module for evaluating
code: http://gopaste.org/view/C8l0w | logs:
http://go-lang.cat-v.org/irc-logs/go-run/
19:42 -!- mode/#go-run [-o Gracenotes] by Gracenotes
19:44 < exch> > i := int(2); rv := reflect.MakeZero(reflect.Typeof(i));
fmt.Printf("%#v", rv);
19:44 <+rndbot> <Error: undefined: reflect>
19:49 -!- saml [n=sam@h-66-134-168-26.nycmny83.static.covad.net] has joined
#go-run
19:49 -!- hnaz [n=hannes@85.214.51.133] has joined #go-run
19:54 < Gracenotes> exch: hm..  that looks safe enough to import, right?
19:54 < Gracenotes> just not in conjunction with "unsafe" :)
20:11 < exch> yea.  i'd keep unsafe out :p
20:12 -!- p4p4__ [n=P4p4@24.106.113.82.net.de.o2.com] has joined #go-run
20:27 -!- p4p4 [n=P4p4@24.106.113.82.net.de.o2.com] has quit [Success]
20:27 < rbohn> > j := 1.0; for i := j; i == j; i,j = i*0.5, i {};
fmt.Print(i,j)
20:28 <+rndbot> <Error: undefined: i>
20:28 < rbohn> > j := 1.0; for i := j; i == j; i,j = i*0.5, i
{fmt.Println(i,j)}
20:28 <+rndbot> 1 1
20:29 < rbohn> >for i := 1.0; i != i*0.5; i = i*0.5i {fmt.Println(i)}
20:29 < rbohn> > for i := 1.0; i != i*0.5; i = i*0.5i {fmt.Println(i)}
20:29 <+rndbot> <Error: syntax error near i>
20:30 < rbohn> @eval 1 != 2
20:30 <+rndbot> true
20:30 < rbohn> > for i := 1.0; i != i*0.5; i = i*0.5 {fmt.Println(i)}
20:30 <+rndbot> 1 0.5 0.25 0.125 0.0625 0.03125 0.015625 0.0078125
0.00390625 0.001953125 0.0009765625 0.00048828125 0.00024414062 0.00012207031...
20:40 -!- p4p4__ [n=P4p4@24.106.113.82.net.de.o2.com] has quit [Client Quit]
23:00 -!- saml [n=sam@h-66-134-168-26.nycmny83.static.covad.net] has quit
["Leaving"]
--- Log closed Wed Nov 25 00:00:29 2009