code logs -> 2012 -> Sat, 29 Sep 2012< code.20120928.log - code.20120930.log >
--- Log opened Sat Sep 29 00:00:09 2012
00:34 You're now known as TheWatcher[T-2]
00:42 You're now known as TheWatcher[zZzZ]
00:52
< Nemu>
So, what's the transferability of what I'm doing, right now? A large part of my time has gone into developing tricks that let my overload Matlab's subscripted reference and assignment functions to make classes that exist and add functionality, but act transparently. So, when I call exp.session, I'm actually stepping into experiment_element, experiment, session_container, session_element, session
00:52
< Nemu>
. Is there a similar way to overload subscripting in other languages?
00:52
< Nemu>
Err, similar capabilities, rather
01:06
<&ToxicFrog>
I don't know enough matlab to fully grasp what you're doing, but AIUI you're installing custom behaviour for (foo.bar) and (foo.bar = baz) to do OO-style stuff?
01:07
<&ToxicFrog>
If so, the answer is (as always) "it depends on the language".
01:08
<&Derakon>
Python lets you make foo[index] work on any object.
01:08
<&Derakon>
You just have to implement __getattr__ and __setattr__, IIRC.
01:09
<&ToxicFrog>
C/++ don't. Java and Scala don't. Lua does (__index and __newindex), as does Python (__getattr__ and __setattr__).
01:12
<&ToxicFrog>
Clojure actually has . and .. as macros in their own right which allows for all kinds of trickery, and a convention that collections are functions of their keys.
01:14
<&ToxicFrog>
Derakon: unlike Lua, in python t["foo"] and t.foo are not eqv
01:14
<&Derakon>
I did not know that.
01:15
<&ToxicFrog>
In particular, t.foo will look for the attribute foo, and failing that, will call __getattr__
01:16
<&ToxicFrog>
t["foo"] will immediately call __getitem__, and if that fails, __missing__
01:16
<&Derakon>
Oh, wait, sorry.
01:16
<&Derakon>
For some reason I thought you were drawing a distinction between t[string] and t[int].
01:17
<&ToxicFrog>
Python draws a sharp distinction between "attributes" (methods/members) and "contents" (collection contents)
01:17
<&ToxicFrog>
No.
01:17
<&Derakon>
As opposed to t.__getattr__(foo) and getattr(t, foo)
01:17
<&ToxicFrog>
I'm drawing a distinction between subscripting with . and subscripting with [], which are the same operation in Lua and different ones in Python.
01:19
<&ToxicFrog>
Those are also different, although that isn't what I was originally talking about
01:19
<&ToxicFrog>
IIRC, getattr(t, foo) is eqv to looking up foo in t's member table, then t's ancestors, and then calling t.__getattr__(foo)
01:20
<&Derakon>
getattr(t, foo) should be roughly equivalent to t.__dict__[foo]
01:20
<&ToxicFrog>
Yes.
01:20
<&ToxicFrog>
Note that subscripting with [] does none of this but instead uses __getitem__ (and __setitem__, __delitem__, etc)
01:28 Nemu_ [NeophoxProd@Nightstar-9610f4cb.asahi-net.or.jp] has joined #code
01:28 Netsplit *.net <-> *.split quits: cpux, Tarinaky, @Tamber, @Kindamoody|afk, himi-cat, @Vornicus, franny, EvilDarkLord, Nemu, Rhamphoryncus, (+6 more, use /NETSPLIT to show all of them)
01:29 Netsplit over, joins: @Tamber, Reiver, &ToxicFrog, AnnoDomini, froztbyte, EvilDarkLord, @Kindamoody|afk, Rhamphoryncus, franny, ~Vornicus (+5 more)
01:48 Derakon is now known as Derakon[AFK]
01:56
< Nemu_>
Hmm. Yeah. I have a little bit of C++ OOP experience, and I couldn't think of a way to do what I'm doing now in C++.
01:58
<&ToxicFrog>
I can't offhand think of any statically typed language that lets you do this, actually.
01:58
<&ToxicFrog>
Although C++ does let you overload the [] operator.
01:59
<&ToxicFrog>
(in C++ and most JVM languages in particular, uses of . are at least partially resolved at compile time, not run time)
02:24
<&McMartin>
(In C++, . is always resolved entirely at compiled time unless it's syntactic sugar for a ->)
02:28 Attilla [Obsolete@Nightstar-bae4b344.as43234.net] has quit [Ping timeout: 121 seconds]
02:50
< celticminstrel>
What're we talking about here?
02:51
< celticminstrel>
(When would . be syntactic sugar for -> anyway?)
02:52
<~Vornicus>
a.b is &a -> b, iirc
02:52
< celticminstrel>
Isn't it defined the other way around?
02:52
< celticminstrel>
ie, a->b is (*a).b
02:53
<~Vornicus>
Same deal.
02:54
< celticminstrel>
Except I don't see how either way makes it syntactic sugar (at least in C++; in C I could see -> being syntactic sugar for .)
03:37
<&ToxicFrog>
celticminstrel: references?
03:39
< celticminstrel>
Hm?
03:40
< celticminstrel>
References for what exactly?
03:40
< celticminstrel>
Oh wait, you mean . applied to a reference?
04:12
<&ToxicFrog>
Yes.
04:12
<&ToxicFrog>
size_t foo(Thingy & bar) { return bar.count; }
04:12
<&ToxicFrog>
In other news, I just discovered afuse
04:20
<&McMartin>
References, yes.
04:21
<&McMartin>
size_t foo(Thingy &bar) { return bar.count; } compiles to the same code as foo(Thingy *bar) { return bar->count; } to a first approximation.
04:21
<&McMartin>
But in the absence of references, for instance, "foo.bar()" is a straight-up C-style function call because you know the raw type right there.
04:22
<&McMartin>
What is afuse?
04:23
<&McMartin>
Or rather
04:23
<&McMartin>
"what is nice about afuse becuase I don't recognize what's exciting here"
04:35 Nemu_ is now known as Nemu
04:36
<&ToxicFrog>
"ls /net/orias" automatically creates /net/orias and mounts orias on it using sshfs.
04:37
<&ToxicFrog>
"orias" can be replaced with the hostname of any system I can resolve and have SSH keys for.
04:37
<&ToxicFrog>
"sshfs" can be generalized to any FUSE filesystem that can be mounted without user interaction.
04:37
<&McMartin>
Mmm. I guess the part where I'm missing the plot is why being able to do that dynamically is fabulous~
04:38
<&McMartin>
But then, I also don't run ssh-agent, so
04:38
<&ToxicFrog>
Neither do I
04:38
<&ToxicFrog>
Mainly it's just convenience
04:38
<&ToxicFrog>
Not having to sshfs each system by hand before I access it
04:38
<&ToxicFrog>
Given that there's like five systems I sshfs on a regular basis
04:47
<&ToxicFrog>
Hrm.
04:47
<&ToxicFrog>
Either sshfs or encfs doesn't implement link().
04:51
<&ToxicFrog>
This would not normally be a problem except that obnam expects it.
04:52 Rhamphoryncus [rhamph@Nightstar-cc6253d6.abhsia.telus.net] has quit [Client exited]
06:08 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has joined #code
06:08 mode/#code [+o Vash] by ChanServ
06:31 celticminstrel [celticminst@Nightstar-05d23b97.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
07:00 Syloq_Home [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Connection closed]
07:02
< Tarinaky>
Okay...
07:03
< Tarinaky>
I have two lists of email addresses.
07:03
< Tarinaky>
How can I merge them into a super-set?
07:14 Kindamoody|afk [Kindamoody@Nightstar-5b3db968.telia.com] has quit [Ping timeout: 121 seconds]
07:14 Derakon[AFK] is now known as Derakon
07:15 Kindamoody|afk [Kindamoody@Nightstar-5b3db968.telia.com] has joined #code
07:15 mode/#code [+o Kindamoody|afk] by ChanServ
07:42 Derakon is now known as Derakon[AFK]
07:45 Vash [Vash@Nightstar-e8057de2.wlfrct.sbcglobal.net] has quit [[NS] Quit: I lovecraft Vorn!]
09:43
< Nemu>
Well, bother. I stepped back from my creation and looked at what I had made
09:44
< Nemu>
Essentially, an array that returns the last element if called without a subscript.
09:44
< Nemu>
...This took me a week
09:46
< Nemu>
It was more impressive before I refactored and generalized everything to it's base components
10:23 You're now known as TheWatcher
11:02 * McMartin blinks at Ubuntu
11:02
<&McMartin>
I appear to suddenly support OpenGL 3.0
11:03
<&McMartin>
I'm *sure* it was at 2.1 the last time I checked.
11:04 himi-cat [fow035@Nightstar-5d05bada.internode.on.net] has quit [Connection reset by peer]
11:06 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
11:06 mode/#code [+o himi] by ChanServ
12:29 You're now known as TheWatcher[afk]
13:10 Attilla [Obsolete@Nightstar-bae4b344.as43234.net] has joined #code
15:07 Syloq_Home [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
15:51 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
16:02 Attilla [Obsolete@Nightstar-bae4b344.as43234.net] has quit [Ping timeout: 121 seconds]
16:03 Attilla [Obsolete@Nightstar-bae4b344.as43234.net] has joined #code
16:05 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
16:05 mode/#code [+o himi] by ChanServ
16:09
< rms>
Tarinaky: cat file1 file2 | sort -u
16:32 Attilla_ [Obsolete@Nightstar-bda31df3.as43234.net] has joined #code
16:34 Attilla [Obsolete@Nightstar-bae4b344.as43234.net] has quit [Ping timeout: 121 seconds]
16:56 Rhamphoryncus [rhamph@Nightstar-cc6253d6.abhsia.telus.net] has joined #code
17:16
< Tarinaky>
rms: Too late, a friend suggested cat a b|sort |uniq
17:25
< AnnoDomini>
A /b/-sort? Wouldn't that be a tad random?
17:27
< Tarinaky>
=.=
17:27 Attilla_ [Obsolete@Nightstar-bda31df3.as43234.net] has quit [Ping timeout: 121 seconds]
17:28
<@Tamber>
AD: It'd be highly random, offensive; then tell you to kill yourself because it doesn't like what you're sorting. :D
17:28
< AnnoDomini>
But it can count to frosted butts!
17:38
< Tarinaky>
But cats get all the Karma on reddit.
17:39
< Tarinaky>
Yo dawg, we herd u liked cats so we 'cat cat1 cat2 ... catN | cat' so you can cat while you cat.
17:54 Attilla [Obsolete@Nightstar-bda31df3.as43234.net] has joined #code
18:16 Attilla [Obsolete@Nightstar-bda31df3.as43234.net] has quit [Ping timeout: 121 seconds]
18:22 Attilla [Obsolete@Nightstar-bda31df3.as43234.net] has joined #code
18:43 Attilla_ [Obsolete@Nightstar-78cc8c64.as43234.net] has joined #code
18:45 Attilla [Obsolete@Nightstar-bda31df3.as43234.net] has quit [Ping timeout: 121 seconds]
18:47 Attilla_ [Obsolete@Nightstar-78cc8c64.as43234.net] has quit [Ping timeout: 121 seconds]
18:51 Attilla [Obsolete@Nightstar-78cc8c64.as43234.net] has joined #code
19:15 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
19:18 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
19:18 mode/#code [+o PinkFreud] by ChanServ
19:24 You're now known as TheWatcher
20:15 Rhamphoryncus [rhamph@Nightstar-cc6253d6.abhsia.telus.net] has quit [Client exited]
21:30 Derakon[AFK] is now known as Derakon
22:18 RichyB [richardb@Nightstar-86656b6c.cable.virginmedia.com] has joined #code
22:40 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
22:53 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
22:53 mode/#code [+o himi] by ChanServ
--- Log closed Sun Sep 30 00:00:24 2012
code logs -> 2012 -> Sat, 29 Sep 2012< code.20120928.log - code.20120930.log >

[ Latest log file ]