code logs -> 2016 -> Sat, 13 Feb 2016< code.20160212.log - code.20160214.log >
--- Log opened Sat Feb 13 00:00:16 2016
00:05 kylo-ren [cmnd@Nightstar-nelvj0.dyn.optonline.net] has quit [Connection closed]
00:44 Derakon[AFK] is now known as Derakon
01:53 Derakon is now known as Derakon[AFK]
03:50 celticminstrel [celticminst@Nightstar-3nv7ni.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
04:31 macdjord|slep [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has quit [Ping timeout: 121 seconds]
05:04 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
05:07 * Vornicus gnaws his brain, tries to get through the basic engineering so he can get to the part where he actually does the thing he wanted to actually do
05:24 * Vornicus determines he does not really know what the hell kind of object inheritance structure he wants and he doesn't know how to make any of them from scratch anyway.
05:27
<&McMartin>
Is this for Vorns ahoy and why are you reinventing not merely the wheel but the manual transmission
05:29
<~Vornicus>
Because I'm a dumbass
05:30
<&McMartin>
It turns out I have Opinions about Polymorphism
05:30
<~Vornicus>
Part of this is, I'm working in Lua, and fuckin' nothing is just there in Lua.
05:30
<&McMartin>
If you have an intended implementation language I can probably talk about... aha.
05:30
<&McMartin>
... is there a reason you're using Love2d instead of Pygame here
05:31
<~Vornicus>
Because every time I've tried pygame I had to write my own damn *event loop*
05:31
<&McMartin>
Okay
05:31
<~Vornicus>
And if I don't, or if I screw it up in any of the subtle ways that it's possible to screw that up, my program hangs.
05:31
<~Vornicus>
And that part at least I don't have to do in love2d
05:32
<&McMartin>
I would start with tables that map constants to callable objects
05:32
<&McMartin>
No inheritance beyond duck typing becuase fuck inheritance, and it's closer to Python and allows monkey-patching
05:32
<&McMartin>
Also obviously Vorns Ahoy's semantics should involve duck typing.
05:33
<&McMartin>
THE COSMOS COMMANDS IT
05:33
<&McMartin>
The All-Father is fond of dad jokes
05:33
<&McMartin>
Once inheritance becomes necessary I would seriously consider prototypal inheritance, but I forget how to actually do that in Lua.
05:34
<~Vornicus>
But then with lua i'm like -- okay how do I want this to work and I have to start at the bottom and I don't know how to name things and then I'm like -- shit, this interface is the same all over the place. Everything has an update and it does a lot of the same things and a little of the different things
05:34
<&McMartin>
Duck typing at the actual lua level, I think, and then track protocols by hand
05:35
<~Vornicus>
So if I then make congo bongo or donkey kong I do monkey patching
05:35
<&McMartin>
Makes sense to me
05:36
<~Vornicus>
(man, fuckin' congo bongo)
05:36
<&McMartin>
I think the way I'd do this is not have true inheritance, but have template objects for each class
05:36
<&McMartin>
Instantiating the class is cloning that table
05:36
<&McMartin>
And it preloads the non-monkeypatched methods &c
05:37
<&McMartin>
"Inheritance" can be worked in by hand by having some templates share implementations of some methods
05:38
<&McMartin>
Lua's method call syntax works well with this IIRC
05:40
<~Vornicus>
Yeah, lua has pretty convenient stuff for this -- I made a set class one time and I forget what it was for but it was not hard.
05:41
<&McMartin>
If you want Actual vtables it's more of a bummer
05:41
<&McMartin>
but you don't want those, because Quack
05:45
<~Vornicus>
Ok so: 1. make any methods I want to be common as just functions and then assign them in where I want them, or in the most complex case make a table with them all in it and then clone + patch for polymorph. 2. Other than that, things do whatever the hell they want, so long as they follow the necessary interface/protocol, which is explicit in my docs. 3. quack.
05:45
<&McMartin>
quack.
05:46
<&McMartin>
2 may just be the most convenient way to lay them out even without patching
05:48
<~Vornicus>
This works out because (for instance) I have things that need to draw both before and after things it contains (ducks can be indoors or out, and the gondola can go behind tall roofs), so not enforcing a particular method for draw or update works better.
05:49
<&McMartin>
A good thing to do with that also is to sort drawables in priority order and draw in reverse priority order
05:52
<~Vornicus>
It is true.
05:52
<~Vornicus>
Perhaps "just declare your drawables and return them, don't actually draw anything yourself" is a decent idea
05:57
<&McMartin>
Now I am wondering what all lives at the code zoo
05:57
<&McMartin>
duck types, monkey patching, yak shaving
05:57
<~Vornicus>
I can't name a game with yaks so that's not happening
05:57
<~Vornicus>
though I did quite a bit of yak shaving lately as you can tell
05:58
<&McMartin>
this is unrelated to games now, just coding terms that are animal-related
06:08
<~Vornicus>
two kinds of ducks
06:08
<~Vornicus>
one's rubber
06:14
<&McMartin>
Ah yes
06:14
<&McMartin>
Also goldfish for that one
06:14
<&McMartin>
Also augh, I am tired
06:15
<&McMartin>
And yet these cookies have not been eaten yet
06:16 macdjord [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has joined #code
06:16 mode/#code [+o macdjord] by ChanServ
06:29 macdjord [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has quit [[NS] Quit: I have been... and always shall be... your friend.]
06:42 Derakon[AFK] is now known as Derakon
06:58 Derakon is now known as Derakon[AFK]
07:20 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
07:23
<&jerith>
I find that dog debugging works better than rubber duck debugging.
07:23
<&jerith>
Dogs listen more attentively.
07:23
<&jerith>
And are happy to go away if your problem is too boring.
08:14 Kindamoody[zZz] is now known as Kindamoody
08:28 macdjord [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has joined #code
08:28 mode/#code [+o macdjord] by ChanServ
09:01 catadroid [catalyst@Nightstar-7ffc9s.cable.virginm.net] has joined #code
09:13 gizmore [kvirc@Nightstar-ticgdn.dip0.t-ipconnect.de] has joined #code
09:31 gizmore|2 [kvirc@Nightstar-ticgdn.dip0.t-ipconnect.de] has joined #code
09:34 gizmore [kvirc@Nightstar-ticgdn.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
09:47 gizmore|2 [kvirc@Nightstar-ticgdn.dip0.t-ipconnect.de] has quit [[NS] Quit: KVIrc 4.9.1 Aria http://www.kvirc.net/]
10:18 ErikMesoy [Erik@Nightstar-hq72t5.customer.cdi.no] has quit [Ping timeout: 121 seconds]
11:01 ErikMesoy [Erik@Nightstar-hq72t5.customer.cdi.no] has joined #code
11:38 catadroid [catalyst@Nightstar-7ffc9s.cable.virginm.net] has quit [[NS] Quit: Bye]
12:43 Kindamoody is now known as Kindamoody|out
13:19
<@abudhabi>
https://boingboing.net/2016/02/12/nigerian-astronaut-lost-in-spa.html
13:21
<@gnolam>
Hee
14:29
<@abudhabi>
It's nice to see that the USB hub I have works even unpowered.
14:54 celticminstrel [celticminst@Nightstar-3nv7ni.dsl.bell.ca] has joined #code
14:54 mode/#code [+o celticminstrel] by ChanServ
16:03 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has joined #code
16:03 mode/#code [+o Crossfire] by ChanServ
16:30 gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [[NS] Quit: The speech pleases him. Lord Ipsulot will be spared, and the worlds of Bok will not be smashed.]
18:08 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
18:08 mode/#code [+qo Vornicus Vornicus] by ChanServ
18:19 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has joined #code
18:29
<~Vornicus>
...huh. It occurs to me as I write this how rarely I use a for loop without a collection to iterate over
18:29
< gizmore>
java sucks
18:30
<~Vornicus>
you say this as though I've used java in the past, uh, 12 years
18:31
<@abudhabi>
Java is OK.
18:32
<~Vornicus>
though nwo it occurs to me you might not have been replying to me and I apologize for the misunderstanding
18:53
<&jerith>
That was either a reply to you or a very strange non-sequitur.
19:00
<@abudhabi>
It is quite a strange reply too!
19:01
< ErikMesoy>
My memories of java are an endlessly repeating chant of "public static void main string args".
19:06 Kindamoody|out is now known as Kindamoody
19:06
<&jerith>
Java is not a very nice language.
19:06
<&jerith>
But it has its uses.
19:26
<&McMartin>
You should only be saying that once.
19:33 Derakon[AFK] is now known as Derakon
19:33
<&Derakon>
Erik: never did any GUI work in Java, eh? foo.addActionListener(new ActionListener() {@Override public void actionPerformed(ActionEvent e) {actually do something;}});
19:37
<&McMartin>
Derakon: Right, but people don't usually object to that the way they appear to object to classes-as-mandatory-namespace or to access modifiers
19:37
<&McMartin>
Er, or to nonmodal access modifiers, rather
19:38
<&Derakon>
"Access modifiers"?
19:38
<~Vornicus>
public, private, protected
19:38
<&Derakon>
Classes-as-mandatory-namespaces is moderately annoying, but I can cope with it. Java's infinite verbosity and awful support for reflection and lambdas (we're still stuck with Java 6 :( ) are the things that annoy me most.
19:38
<&Derakon>
Ah.
19:39
<~Vornicus>
specifically, they complain that in C++ you can go public: foo... bar... baz... private: quux... blarg... floogy... but in Java you have to mention each one.
19:39
<@abudhabi>
What really annoys me about Java is that it has null.
19:39
<@abudhabi>
And NPE.
19:40
<&Derakon>
The only thing about Java's null that bugs me is that I can't compare (potentially null variable A) to (potentially null variable B).
19:41
<&Derakon>
Whereas e.g. Python will let you compare (potentially None variable A) to (potentially None variable B) and return true if they're both None or (neither is None and they compare equally in whatever type they have)
19:41
<@abudhabi>
I would like a pirate elvis operator.
19:41
<@abudhabi>
And optionality that isn't horrible.
19:43
<&McMartin>
Don't settle for optionality
19:43
<&McMartin>
Get proper variants
19:43
<&McMartin>
As usual, "proper" for both means "like Haskell does it" >_>
19:43
<&Derakon>
Optionality, as in optional function arguments? That'd be nice to have.
19:43
<&Derakon>
As would be named parameters.
19:43
<&McMartin>
I was reading it as nullable types
19:43
<@abudhabi>
Yes.
19:43
<&Derakon>
Ah, yes.
19:43
<@abudhabi>
Java already das optional params, sort of.
19:43
<&McMartin>
e.g, variables that are "thing that is type X, or None, and nothing else"
19:44
<@abudhabi>
There's ... and all.
19:44
<&Derakon>
That doesn't count.
19:44
<&McMartin>
... is variadic, not optional
19:44
<@abudhabi>
It can be 0 or more! That sounds optional to me.
19:44
<&McMartin>
Java does optional arguments by defining each combination and relying on overloads for the rest.
19:45
<&McMartin>
... is an infinite number of those, so it requires a separate feature.
19:45
<&Derakon>
I mean, you could conceivably do optional with variadic by taking an Object... and then examining the number of parameters passed in and selecting defaults as needed.
19:45
<&Derakon>
But holy crap that would be awful.
19:45
<&McMartin>
... No, that's not how it's done
19:45
<&McMartin>
If you have three arguments, the last two of which are optional
19:45
<&McMartin>
You define three functions with the same name
19:45
<&Derakon>
Yes, I know.
19:45
<&McMartin>
Two of which are one-line forwards
19:45
<&Derakon>
That is also awful.
19:45
<&McMartin>
This is actually, arguably, better than C++ optional arguments
19:45
<&McMartin>
Where what the optional argument is depends on which header you included.
19:46
<&McMartin>
The correct thing is to take something that looks like the second and compile it to the first~
19:47
<&McMartin>
So that changing the default value doesn't necessitate recompiling all code that links against it
19:47
<&McMartin>
Unless you're in the camp that says this is a feature~
19:48
<&McMartin>
That said, what you described as "holy crap that would be awful" is a thing Clojure can do trivially
19:48
<&McMartin>
Because it turns out destructuring pattern-match as a basic control flow construct is hax~
19:50
<&Derakon>
I meant it would be awful in Java.
19:50
<&Derakon>
Just imagining the "okay, I have 3 arguments, which means I cast the first to an Integer, the second to a Rectangle, etc. etc. etc."
19:51
<&McMartin>
I bet you could get that into a pretty idiomatic form
19:51
<&McMartin>
something like a chain of Integer i = args.length >= 1 ? args[0] : new Integer(3);
19:52
<&McMartin>
I guess there'd be the cast
19:52
<&McMartin>
And of course you've lost compile-type checking of arguments there.
19:53
<&Derakon>
Yep.
19:53
<&Derakon>
Would it stop you from passing an int or double or the like in?
19:53
<@abudhabi>
Specifically what I would want: some.chain.of.delegation() to return null instead of throwing NPE if it tries to dereference one of those nulls, and transcribing optional variables as empty strings instead of "null" or throwing NPE because null.toString() doesn't exist.
19:57
<~Vornicus>
you don't get that former in, like, any sensible language
19:58
<@abudhabi>
What about the languages that implement '.?' in addition to '.'?
19:59
<&ToxicFrog>
Vornicus: I know that I've worked with a few where "nil.foo" and "nil.foo()" are both nil, i.e. they behave similar to NaN, but I can't remember names offhand
19:59
<&ToxicFrog>
(you can get lua to behave like this with __index and __newindex, but you probably shouldn't)
20:02
<&McMartin>
Objective-C allows you to invoke any method in the universe on nil, and it returns nil
20:02
<&McMartin>
However
20:02
<&McMartin>
This is only a feature if you believe that a program should never halt execution
20:03
<&McMartin>
fail-fast vs. fail-soft is a design decision
20:07
<@abudhabi>
I'm a web dev. If the website crashes, that's awful.
20:07
<@abudhabi>
If the user gets a blank page due to NPE instead of a formal error message, that's not good either.
20:13
<~Vornicus>
This does not seem like the kind of thing that would be fixed by allowing nil pollution
20:13
<&McMartin>
And if a user gets "nil" instead of the content you intended becaues the value propagated from any of the past 15,000 operations, that's just as bad but there's no stack trace because the language says that's not an error.
20:14
<&McMartin>
But yes, that is the entire argument.
20:14
<&McMartin>
Fail-soft says "programs aren't supposed to stop working"
20:14
<&McMartin>
Fail-fast says "when they do, they should stop at the point where the problem actually happened, not when life support finally gave out"
20:14
<&ToxicFrog>
My general use case for that is "I have a chain of operations, some of which may return nil, and I want to nil check once at the end of the chain rather than checking every single operation, because the fail case is the same regardless"
20:14
<&McMartin>
Right
20:15
<&McMartin>
This is where I say "you actually want a variant there", and this is where Rust's try! macro carries the day
20:15
<&McMartin>
Though I'm not 100% sure that works cleanly for operations whose error types are different error types.
20:19
<&McMartin>
Ah, no, try! isn't the one I'm thinking of.
20:19
<&ToxicFrog>
Tragically, I find that I usually run into this in languages that don't have such things.
20:19
<&ToxicFrog>
Actually, thinking back on it, usually Java.
20:19
<&McMartin>
Well
20:20
<&McMartin>
That's because the only languages with variant types are the ML-descendants, so you've got, um, ML, Haskell, and Rust, basically.
20:20
<&McMartin>
Maybe swift, but they keep mutating how those work to fit with the ObjC ABI and I'm not sure they do an equivalent of Result.
20:22
<&McMartin>
But yeah, C#'s .? is basically a nilcheck at the end for the sequence you describe, and it also has i ?? x which is i != null ? i : x
20:23
<&ToxicFrog>
Clojure has some-> and some->>, which is basically exactly what I want
20:23
<@abudhabi>
Which would be great in my use cases, where I usually remember to check for getting a null value out of the chain, but not that each particular element of the chain is not null itself.
20:24
<&ToxicFrog>
(-> v f g h) is eqv to (h (g (f v))); ->> is similar but has different behaviour if the functions already have arguments. the some- variants short out to nil if any operation in the chain returns nil.
20:26
<&McMartin>
Yeah. That particular operator is useless if you aren't primarily functional, though
20:26
<&McMartin>
The member access equivalent in C# is ?g.?h.?f(v)
20:26
<&McMartin>
er, minus the first ?
20:27
<&McMartin>
Also IIRC, it has been quite a while since I have used an Ada-class language
20:30
<&McMartin>
(Seriously, beyond the syntax borrowing more from C than Pascal, Ada 95 seems to have prefigured the entire Java-descended class of languages. https://en.wikipedia.org/wiki/Ada_%28programming_language%29#Control_structures )
20:30
<&McMartin>
(That is, Ada looks more Pascal-y, Java looks more C-y)
20:40
<&McMartin>
Also, argh
20:40
<&McMartin>
This was-supposed-to-be-short post about offset assembly keeps wanting to be about DLLs and TLBs instead.
20:42 Kindamoody is now known as Kindamoody|afk
20:59 gizmore|2 [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has joined #code
21:00 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has quit [Operation timed out]
21:34 Kindamoody|afk is now known as Kindamoody
21:45 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has joined #code
21:47 gizmore|2 [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
21:52 gizmore|2 [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has joined #code
21:53 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has quit [Operation timed out]
22:09 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has joined #code
22:10 gizmore|2 [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has quit [Operation timed out]
22:13 Kindamoody is now known as Kindamoody[zZz]
22:14 gizmore [kvirc@Nightstar-af6i8r.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
22:40 ion_ [Owner@Nightstar-6grqph.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
22:40 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
23:59 ErikMesoy [Erik@Nightstar-hq72t5.customer.cdi.no] has quit [[NS] Quit: Leaving.]
23:59 ErikMesoy [Erik@Nightstar-hq72t5.customer.cdi.no] has joined #code
--- Log closed Sun Feb 14 00:00:32 2016
code logs -> 2016 -> Sat, 13 Feb 2016< code.20160212.log - code.20160214.log >

[ Latest log file ]