#go-nuts

/

      • GeorgeJ has quit
      • nitrix
        Can I check if my object has an implementation for its interface at runtime ?
      • nevir
        Tv`: oh, that's super handy
      • Pwnna
        the {} is still annoying ;)
      • doomlord joined the channel
      • jessta
        nitrix: a type assertion will do it
      • nevir
        ah, I was missing the reference to go help testflag; -v and a note about eating output should totally go into the top level help for test
      • Tv`
        nitrix: _, ok := o.(TheInterface)
      • nevir: i shot myself in the foot with the same, a few months back
      • nitrix: also, the https://botbot.me/files/freenode/go-nuts/"itshttps://botbot.me/files/freenode/go-nuts/" in that sentence sounds very wrong
      • nevir
        Yeah, it was pretty confusing https://botbot.me/files/freenode/go-nuts/"wtf, my tests aren't running!?https://botbot.me/files/freenode/go-nuts/" when trying to understand some init() calls in my code
      • nitrix
        Tv`: I have a renderer, calling drawing methods on verious implementation of a Stage (login screen, game screen, etc), and I want the renderer to stop if it cannot call Update, or Render for example.
      • dominikh
        it shouldn't deal with objects that can't update or render in the first place
      • derdon has quit
      • jessta
        Pwnna: goroutines only make sense internal to a process.
      • Tv`
        nitrix: if all you do is ask them to .Quack(), don't take non-ducks in
      • Pwnna
        jessta: why?
      • nitrix
        Tv`: does go check it, or you can actually have an implementation for an interface that is lacking methods?
      • Tv`
        nitrix: interface{} exists but means https://botbot.me/files/freenode/go-nuts/"anything goeshttps://botbot.me/files/freenode/go-nuts/"
      • Pwnna
        errnoh: src/github.com/skelterjohn/go.wde/xgb/xgb.go:21:2: import https://botbot.me/files/freenode/go-nuts/"github.com/BurntSushi/xgbhttps://botbot.me/files/freenode/go-nuts/": cannot find package
      • ?
      • nitrix
        Tv`: I'll make sure it it doesn't happen then. I'm just curious about the language itself. cool
      • CatMtKing joined the channel
      • Tv`
        Pwnna: did you use https://botbot.me/files/freenode/go-nuts/"go gethttps://botbot.me/files/freenode/go-nuts/"?
      • Pwnna
        yeah
      • dominikh
        nitrix: type Renderable interface { Draw(); Update(); } func render(r Renderable) // you will never be able to call render with something that doesn't have both the Draw() and Update() methods
      • mennis has quit
      • errnoh
      • Pwnna
        what does that do?
      • errnoh
        -v is verbose, -u is update
      • ... also gets and installs folders under go.wde, which it in this case needs
      • Pwnna
        hm
      • jessta
        Pwnna: most channel communication in not buffered, lots of code uses locks, lots of pointers are passed around on channels
      • ibk has quit
      • Pwnna
        jessta: but that's just implementation though
      • the idea could scale to multimachines?
      • jessta
        Pwnna: goroutines expect to be in a shared memory environment and this gives them certain advantages.
      • errnoh
        you don't really need the -v and -u flags but -v is nice for sanity check :)
      • Pwnna
        yeah
      • i like that
      • jessta
        Pwnna: it's a requirement of the spec.
      • Pwnna
        jessta: is it? hm
      • derek_c has quit
      • jessta
        Pwnna: the spec allows channels of pointer types
      • errnoh
        Pwnna: go gets fine here btw, did that one work for you?
      • Pwnna
        yup
      • it now works
      • errnoh
        good good
      • ibk joined the channel
      • Pwnna
        let's make a game
      • kinlo
        is there a way to make the json library support lower case names? ie: http://play.golang.org/p/ppzgR42Imn <- I've copied an example and changed Name to name, because the output MUST be in lower case. can this be done?
      • jessta
        Pwnna: a process is a good thing to put on multiple machines
      • dominikh
        kinlo: use tags
      • coredump joined the channel
      • mischief
        Pwnna: fork mine
      • Pwnna
        mischief: wut?
      • mischief
        fork my game and work on it :-)
      • Tv`
        kinlo: use tags, `json:https://botbot.me/files/freenode/go-nuts/"namehttps://botbot.me/files/freenode/go-nuts/"`
      • kinlo
        dominikh: is that documented somewhere?
      • dominikh
        kinlo: yes, for example in the docs for the json package ;)
      • nevir
      • Pwnna
        mischief: where's your game? lol
      • also i have way too many things to do!
      • PaulCapestany joined the channel
      • mischief
      • furyofantares has quit
      • kinlo
        oh, tags are to be compared to java's annotations?
      • mischief
        it's not very good yet, but i'm a newb
      • nevir
        kinlo: yeah, pretty similar - only accessible via reflection, afaik
      • Pwnna
        mischief: ascii!
      • kinlo
        nice
      • mischief
        yea vt100 graphics
      • Pwnna
        lol
      • oal joined the channel
      • mischief
        not ascii only, if you have a unicode terminal
      • Pwnna
        how do you structure your project?
      • Project_2501 has quit
      • mischief
        however i feel like at the time
      • like i said, <- newb :-D
      • Pwnna
        are you a channel?https://botbot.me/files/freenode/go-nuts/" ;)
      • nevir
        ha
      • nevir has quit
      • oingu
        ooh my first go program has a circular import loop
      • frostschutz joined the channel
      • i didnt think it disallowed that, guess i should read more docs
      • jessta
        oingu: circular imports are problematic. initialisation order becomes impossible.
      • oingu: if you have circular imports think hard about whether those packages should be seperate packages
      • errnoh
        oingu: you can usually get past those by using interfaces
      • oingu
        Yea i only know C and Python
      • one cares, one doesnt, i thought go was of the wrong camp ... it's OK, i dont blame the language or anthing
      • Tv`
        C has no imports.
      • dmitrijus
        well, if you have circular importshttps://botbot.me/files/freenode/go-nuts/, shouldn't they be in the same package? :)
      • oingu
        it's really not a problem
      • jessta
        oingu: C also has no per-import initialisation.
      • matiu joined the channel
      • matiu has quit
      • matiu joined the channel
      • oingu
        i was just treating the imports as includes, and they arent
      • Horsey joined the channel
      • so now i know, i can use my python experience to separate them
      • Pwnna
        wait
      • coredump has quit
      • so what ides/editors do you gyus use?
      • dominikh
        emacs.
      • Pwnna
        komodo doesn't have autoindent with go lang :x
      • errnoh
        vim
      • dmitrijus
        vim.
      • Pwnna
        of course..
      • errnoh
        :D
      • dominikh
        emacs, vim, sublime text 2 are the most common in here (not in that order)
      • errnoh
        I've heard of someone actually using an ide!
      • dominikh
        there's LiteIDE for people who really need an IDE (for whatever reason)
      • Pwnna
        komodo edit :x
      • frogprince_mac joined the channel
      • errnoh
        and there's godit as well
      • dmitrijus
        welllll, vim has govim, all the ide features i need! :)
      • Pwnna
        i don't need an ide, just a file manager and some ass kicking theming + awesome autoindenting support.
      • dominikh
        yeah, but godit is very very opinionated
      • errnoh
        yeah :)
      • dominikh
        godit is the linus torvalds of editors
      • tvw has quit
      • Tv`
        dominikh: i think he would be offended, and then offend you ;)
      • errnoh
        Pwnna: what you want is gocode and gofmt macro
      • dominikh
        Tv`: and I'm sure that's exactly what godit would do ;)
      • errnoh
        and those you can have in any editor
      • dmitrijus
        or just learn vim.
      • Pwnna
        what's preferred? camelCase or under_score?
      • dominikh
        camelcase
      • Pwnna
        hm
      • Tv`
        Pwnna: CamelCase for exported, dromedarCase for non-exported
      • dominikh
        (ftr, it's called snake_case)
      • Pwnna
        bah. no autoindent with go plugin for komodo :x
      • MetaCosm has quit
      • pskirko has quit
      • Horsey has quit
      • mkb218 joined the channel
      • kazupon joined the channel
      • errnoh
        Pwnna: you don't need special plugin for that, you only need to run go fmt, preferably from inside the editor
      • MetaCosm joined the channel
      • dominikh
        errnoh: yeah, but you do not want to run gofmt after every single line you enter :)
      • Pwnna
        yeah..
      • errnoh
        well pretty much everything has basic autoindent support
      • dominikh
        it's komodo, expect nothing and still be disappointed :P
      • frogprince_mac has quit
      • errnoh
        it's not something thats language specific most of the time
      • heh :)
      • well can't say that I've tried komodo
      • Benjojo joined the channel
      • dominikh
        (fwiw, gofmt does have some peculiar indentation rules, so https://botbot.me/files/freenode/go-nuts/"basic supporthttps://botbot.me/files/freenode/go-nuts/" will get it wrong quite often; but it's still better than nothing, yeah)