code logs -> 2019 -> Wed, 25 Sep 2019< code.20190924.log - code.20190926.log >
--- Log opened Wed Sep 25 00:00:08 2019
--- Day changed Wed Sep 25 2019
00:00
<&McMartin>
Hmm. I think I need to reorganize this C++ code instead of just burninating it. The abstraction cut was wrong.
00:00
<&McMartin>
Also past me was really keen on ruthlessly exploiting C++'s precisely specified field destruction order, and I can't tell whether to bless him or curse him for it.
00:01
<&McMartin>
jerith: It occurs to me that I never got around to actually asking this: now that you're using it for something of significant size, how are you finding Rust as a tool that fits your hand?
00:17
<@sshine>
does anyone here remember a youtube series called "MVC"? it stars three guys with each their letter on their shirt, and then they have these discussions about responsibilities and social contracts between them as a metaphor.
00:17
<@sshine>
I think they might have been rubyists and that it might've been 10 years ago.
00:18
<@sshine>
maybe less.
00:18
<@sshine>
it's impossible to find anything that old on youtube with the word "mvc" in it.
00:19
<@sshine>
they had a catchy theme song where they sing "m is for model... v's for view. c is for controller" -- okay, I realize that I'm humming in my head now, and that that's terribly unhelpful.
00:27
<~Vornicus>
when I have a song in my head I can't recognize I hum it at my mother
00:27
<~Vornicus>
unfortunately she is much better at jazz and classical than, uh, youtube programming show theme songs
00:27 himi [sjjf@Nightstar-1drtbs.anu.edu.au] has joined #code
00:27 mode/#code [+o himi] by ChanServ
00:29
<@Reiv>
Vornicus: That is indeed rather... specific
00:35
<&McMartin>
... OK, if I weren't around to justify the actions of Past Me here, I'd be pretty mad at Past Me
00:35
<&McMartin>
I was clearly setting up some kind of publish-subscribe clearinghouse for all communication between objects at this, er, tier of the architecture
00:35
<&McMartin>
And I was just as clearly making sure that there was no crosstalk within the tier, just posting of messages someone might subscribe to
00:35
<&McMartin>
... but that extended to things like "registering yourself for callbacks from your own fields", which was, perhaps, excessive.
00:36 * McMartin replaces all that with, like, one method call
00:37
<&[R]>
Got to love needlessly heavy abstraction
00:38
<&McMartin>
I remember what was being factored away from.
00:38
<&McMartin>
That was quite the pendulum
00:38
<&McMartin>
The previous code was a rat's nest of crosstalk
00:38
<&McMartin>
Having done the heavy abstraction in the past, I can now go one step further and turn most of this into a dag
00:38
<&McMartin>
And the ones I *can't*, well. I've got a handy publish-subscribe model right here.
00:43
<&McMartin>
(Actually, now I've got two; this is a prelude to retiring one of them, and unifying these two codebases to use the same one.)
00:51
<&McMartin>
... crap, I just realized what else I was buying with this back then -- independence of the lifetimes of caller and callee
00:51 * McMartin goes to confirm that the callee always outlives the caller
00:52
<&McMartin>
... yeah, OK, that does work
00:52
<&McMartin>
But past me has chastened present me a bit with that.
00:58
< catalyst>
<McMartin> Also past me was really keen on ruthlessly exploiting C++'s precisely specified field destruction order, and I can't tell whether to bless him or curse him for it. <--- stop that
00:58
< catalyst>
stop that now
01:10 celmin|away is now known as celticminstrel
01:24
< Yossarian>
Well, no need for me to worry about that. I have such terrible anxiety about writing code that I never do anymore.
01:28
<&McMartin>
catalyst: The ruthless exploitation or the indecision on bless/curse?
01:28
<&McMartin>
(I'm temporarily doubling down on the exploitation, with one hole punched in it for a single piece of "crosstalk" in the design; ultimately, of course, it will all fall away)
01:29
<&McMartin>
This was an unfortunate case of reverse engineering though, where I started out with "this is really over-engineered, what exactly was I worried about here? I knew better than that then too"
01:29
<&McMartin>
And then the two answers came in at step 20 or so of a 25-step analysis.
01:30
< catalyst>
exploiting that :P
01:30
<&McMartin>
In my defense, it's also enforced by the relevant arguments' constructors
01:30
< catalyst>
though C++'s lifetime rules are one of the reasons I like it
01:30
<&McMartin>
Yeah, that's why I was keen on it, clearly
01:30
< catalyst>
x)
01:31
<&McMartin>
But yeah, this is a chain of objects that take references to other objects in their constructors, and then the object that actually collects all these types together declares the fields such that there is an unbroken line of initialization that lets it pass the fields on to future constructors as past constructors compelte
01:31
< Yossarian>
I wish I had a way of telling if I knew about these things or if I went braindead, but the fear keeps a steady hand...
01:31
<&McMartin>
Except for, here now that the design is done, one goddamn method that needs to be able to talk to the future
01:31
<&McMartin>
So I guess it gets to keep the publish-subscribe mechanism in place.
01:31
<&McMartin>
Yossarian: Fear is the mind-killer
01:32
<&McMartin>
Give in, instead, to your anger that the world lacks the code it needs
01:32
< catalyst>
yeah, that sounds horrendous
01:33
< catalyst>
I'd file that under 'going to break when you change the field order'
01:33
<&McMartin>
It sure is
01:34
< catalyst>
it's always fun when someone shaves off a few padded bytes in optimisation and everything stops working for no obvious reason
01:34
<&McMartin>
And that's why I'd set up this big complicated publish-subscribe model; so that they could use that as a "backplane" for calling methods on each other without needing to hold unsafe/unretained references to one another.
01:34
<&McMartin>
However
01:34
<&McMartin>
I'm migrating away from C++
01:34
<&McMartin>
I get to have a full set of refcounted pointers and weak-pointer delegates as fundamental primitives, and "crosstalk" will just be delegate calls.
01:35
<&McMartin>
But in the mean time, the backplane is in my way and I need to ease the system away from using it, which, happily, I absolutely can except for this one piece of backtalk.
01:36
<&McMartin>
Also, now that the code is Apple-specific, that also means that for the very large number of remaining cases, there is no need to use my custom backplane at all; I can use the standard library's own publish/subscribe system
01:36
<&McMartin>
(Indeed, it turns out that in the end, once the library was put into use, the only use made of the backplane by it was to hook into events and then forward them to the stdlib-based one. So I might as well just, like, use the stdlib-based one.)
01:36
< Yossarian>
I think the fear is tied in with sense of self, but gradually I've stopped thinking or writing code along with a plethora of other things I liked doing.
01:37
<&[R]>
Yossarian: try code challenges
01:37
<&McMartin>
I've had some luck with the challenges at exercism.io, though while they boast a large set of languages, the challenges within each language tend to be extremely similar.
01:37
< Yossarian>
And then every now and again I get rushes of energy but very quickly something throws me off.
01:38
< Yossarian>
Right now I'm in a rural area and last Thursday I went grocery shopping and did tons of laundry, an entire damn day trip, but since then I've been sleeping non-stop. I think a tick finally found its way on me.
01:38
<&[R]>
Drink water, and just prod at stuff even when you're tired
01:38
<&[R]>
If you wait until you're energized you'll never get your energy
01:39
<&McMartin>
And if you're worried about Lyme disease, get yourself checked out
01:39
<&[R]>
He's 1) American 2) broke
01:41
< Yossarian>
I ran out of all my medication early, but I'm waiting for the morning to come. 13 hours.
01:42
< Yossarian>
This weekend I was trying to troubleshoot the issue and that's when I doubled up.
01:49
< Yossarian>
I always unintentionally introduce a variable when I eliminate one, so I need to just eliminate and overall focus on my health because it is rough going.
01:50 * McMartin nods
01:50
<&[R]>
Setup a schedule man, schdule 1-2 hours of excercise, 1-2 of some kind of brain-growth activity (reading, practice, etc), 1-2 hours of life maintenance (cleaning home, doing chores, adulting, etc...)
01:50
<&[R]>
Then fucking follow it
01:51
<&[R]>
Humans need some schedule to their life
01:51
<&[R]>
You have absolutely nothing right now, so make your own, do things on your time
01:52
< Yossarian>
I tried but I got back and I was in bed for two days straight this weekend
01:52
<&[R]>
So? Get back on it the moment you wake up
01:53
<&[R]>
Slept in a little? Skip the first thing, and start on the second thing (assuming you woke up when that'd normally start)
01:54
< Yossarian>
I didn't sleep in a little, I slept some 20 hours straight
01:54
< Yossarian>
following by confused rousing and then repeat
01:54
<&[R]>
Or in other words, if you miss the first thing in the morning, start doing the thing that's scheduled next
01:54
<&[R]>
Okay, so just power through it
01:55
<&[R]>
A schedule will give you discipline, discipline will give you order, order will give you progress, progress will give you achievement, achievement will give you happiness.
01:55
< Yossarian>
yes that is what I was on the way to doing
01:55
< Yossarian>
and then I suddenly got weak around Friday
01:55
<&[R]>
Cool, so you had a mistep. You fell off the horse. The horse is still there, get back on it.
01:56
<&[R]>
You will have misteps
01:56
<&[R]>
Everyone does
01:56
<&[R]>
Stop saying why you didn't do it
01:56
< Yossarian>
there is something legitimately wrong I just don't know what it is
01:56
<&[R]>
Say that you are doing it
01:57
<&[R]>
There's a ton of things wrong with your life, doesn't mean you stop fixing other things when a new thing crops up
01:57
<&[R]>
It's just going to pile up like debt
01:58
<&[R]>
You owe yourself a good life, so work towards that
01:59
<&[R]>
Anyways, BBL, going home
02:00 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
02:04
< Yossarian>
you don't believe me because this is what I always end up saying, but something is going on that interrupts me that isn't of my imagination; I do not know how else to explain the past 72 hours. Err
02:07
< Yossarian>
there is a difference but i think i am the only one able to delineate between the two
02:09
<&McMartin>
If so then there are two things going on and make priorities
02:09
< Yossarian>
i wonder if this is the target rash i feel on my scalp? just, I can't see it but I can feel it
02:10
<&McMartin>
The thing you have overall been describing and that [R] is fighting against sounds like something more long-term, and it's clear they aren't OK with enabling things they think are harmful
02:21
< Yossarian>
i found one
02:32
< Yossarian>
i suppose i will treat, probably get ELIZA for good measure
02:36
< Yossarian>
more engrained and harder to find than i realized but a mirror helps
02:49
<&[R]>
<Yossarian> you don't believe me because this is what I always end up saying, but something is going on that interrupts me that isn't of my imagination; I do not know how else to explain the past 72 hours. Err <-- I'm not saying that it's wrong for you to have stopped because of those interuptions, what's bugging the fuck out of me is how you constantly talk about things like that and use them as excuses
02:49
<&[R]>
Your language is negative and it's worrysome
02:49
<&[R]>
Don't focus on why you didn't do something
02:50
<&[R]>
Focus on how you can do the right things
02:50
<&[R]>
Always look at what you should be doing and look at how you can get there, work towards being the best person you can be
02:50
<&[R]>
Set-backs happen, but you seem to overly dwell on them
02:50
<&[R]>
Just push forward
02:51
<&[R]>
Don't say "I couldn't do X yesterday" say "I am working on X"
02:51
<&[R]>
Look up affirmations
02:52
<&[R]>
Focus on what you can do, and talk about what you can do, what you are doing
02:53
<&[R]>
Also fuck the guy who cut me off then brake-checked me
02:54
<&[R]>
He can eat shit
02:54
<&[R]>
Anyways, I'm going to get back to coding
02:54
< Mahal>
Personally, I feel like a positive focus is valuable; but a certain amount of introspection about why things occur is also valuable, particularly when trying to change your life such that those events don't happen again. Going "WELP BAD THING MOVE ON" does not help analyse your problem.
02:56
<&[R]>
Sure, but the problem here is he wallows in misery about something for *months*
02:56
< Mahal>
I don't know either of you, so -shrug-
02:56
<&[R]>
Fair, I just wanted to add some context
02:57
<&[R]>
I realize that balance is needed, but sometimes that balance is achieved with a really hard push
02:57
< Yossarian>
i found it
02:58
<&[R]>
Hmm?
03:01
< Yossarian>
tick
03:01
<&[R]>
Oh damn
03:01
<&[R]>
Fuck
03:02
<&[R]>
Congrats though
03:07
< Yossarian>
need more DEET
03:11
<&[R]>
https://www.youtube.com/watch?v=cS2ZbiAEiV8 <-- this is strangely on-subject I feel
03:18
<&[R]>
ssh's ~ . is definately the must used power-user thing I've gotten used to using in ssh
03:18
<&[R]>
Though remote command is more used, if you consider that power-user level though
03:21
< Yossarian>
~ . ?
03:21
<&[R]>
Disconnects the ssh session
03:22
<&[R]>
Just litterally hit the keyboard as if you were typing ~.
03:22
<&[R]>
But really fast
03:23
<&McMartin>
Tilde, period, enter. It's a logout code when you're stuck and it is indeed the greatest thing
03:23
<&[R]>
Yeah
03:23
<&McMartin>
Hm, today's Trogdoring was unusually light.
03:24
<&[R]>
Not something you want to use as a first resort
03:24
<&McMartin>
+56 -54, with 14 files changed, and the extra lines are because I had multiple calls on one line and added linebreaks.
03:24
<&[R]>
Also you don't need the enter
03:24
<&McMartin>
Huh, really?
03:24
<&[R]>
Nope
03:24
<&McMartin>
I never actually get disconnected until I hit return.
03:24
<&[R]>
Hmm
03:24
<&[R]>
On a fresh session the return isn't needed
03:25
<&McMartin>
That may well be true
03:25 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
03:25
<&McMartin>
I'm used to this being "I've unslept my laptop but instead of timing out the connection it went off into never never land"
03:25
<&[R]>
Yeah
03:25
< Yossarian>
:(
03:25
<&[R]>
Did I get you to disconnect yourself? Sorry
03:26
<&McMartin>
Nah
03:26
<&McMartin>
I'm on may way out now, anyway
03:27
<&[R]>
I meant Yoss, but TTYL
03:27
<&[R]>
Have a safe trip home
03:27
<&[R]>
Safer than mine as well
03:28
< Yossarian>
nah but i know what happens
03:44 himi [sjjf@Nightstar-1drtbs.anu.edu.au] has quit [Ping timeout: 121 seconds]
03:58
<&[R]>
http://www.cburch.com/logisim/ <-- of potential interest to some of you
04:07 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
04:07 mode/#code [+o Reiv] by ChanServ
04:44 catalyst [catalyst@Nightstar-5dv16h.cable.virginm.net] has quit [Connection closed]
05:11 Pinkhair [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
05:14 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code
05:17 celticminstrel [celticminst@Nightstar-6an2qt.dsl.bell.ca] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
05:32 gnolam [quassel@Nightstar-csto10.cust.bahnhof.se] has joined #code
05:32 mode/#code [+o gnolam] by ChanServ
06:32 gnolam [quassel@Nightstar-csto10.cust.bahnhof.se] has quit [[NS] Quit: Gone]
07:03
<&jeroud>
McMartin: I've mostly stopped fighting the language and am focusing on the problems I'm solving.
07:03
<&jeroud>
Which is a huge improvement.
07:05
<&jeroud>
I can't comment *too* authoritatively on how good a tool it is for the job, because it's the only systems language I've really used for anything nontrivial.
07:06
<&jeroud>
(My C++ experience ~15 years ago was extremely unfortunate, and the C I've done has mostly been smallish and is also over a decade in the past.)
07:07
<&jeroud>
(Except for some tiny amounts of embedded system C which is kind of different from normal C.)
07:07
<&McMartin>
(Yeah, that's "I refuse to put up with your shitty ABI directly kthx")
07:09
<&jeroud>
(More "there is no OS, you have the hardware *entirely* to yourself".)
07:10
<&jeroud>
(The C++ was me taking possession of ~5k lines of generated-and-then-edited code that had been perpetrated by an undergrad the previous year.)
07:12
<&jeroud>
I really really like Rust's type system.
07:14
<&jeroud>
It gives me all sorts of warm fuzzy feelings. But more importantly, it lets me express the my design in ways that the compiler will understand and enforce.
07:14
<&McMartin>
I assume the answer is "yes", but just in case: your Scheme system is single-threaded, right?
07:15
<&jeroud>
Very.
07:15
<&McMartin>
I ask this because even in its very early days, one of the skilled developers of my acquaintance noted that the distinctino between Rc<> and Arc<> *alone* would have been a godsend for some of his contract work back in the '99-03 era.
07:16
<&McMartin>
While he asserted that Rust wasn't there yet at the time, and had particularly sharp words about how enums worked, he said he'd have considered it just for compiler-enforced thread-isolation of data.
07:16
<&jeroud>
My one (futile) concession to that possibly changing at some point is that I use Arc instead of Rc for wrapping shared-ownership things.
07:18
<&jeroud>
The thread isolation is extremely clever, deceptively simple, and depends entirely on the ownership tracking.
07:19
<&jeroud>
It's basically two traits (Send and Sync) that express how/when something can be used concurrently.
07:20
<&jeroud>
And now I've forgotten what they actually do.
07:20
<&McMartin>
Not a problem, really
07:20
<&McMartin>
I don't have spare headspace for Rust right now anyway
07:21
<&jeroud>
But the really clever bit is that you never have to actually think about it (unless you're using unsafe, I guess). You just compose stdlib types that have those traits and the compiler tells you if you're doing it wrong.
07:22
<&McMartin>
Yep.
07:22
<&McMartin>
This is a thing that if you are lucky and in a more restricted way modern C++ will also manage.
07:22
<&McMartin>
catalyst is the one who can actually order it to that, I'm merely at the level that I can understand it when it complains.
07:22
<&McMartin>
Rust has outperformed C++11 on this score since the 1.0 release if not earlier.
07:23
<&jeroud>
This is, in fact, the primary reason Rust exists in the first place.
07:23
<&McMartin>
Yup
07:23
<&McMartin>
And, to be fair
07:24
<&McMartin>
We have learned stuff since 1985
07:24
<&McMartin>
Rust asserts loudly that it's not cutting edge
07:24
<&McMartin>
And it's not; its techniques are stuff that was cutting-edge 20 years ago, when I was a grad student
07:25
<&McMartin>
This is why I take this latest tranche of languages so personally, incidentally. The ivory tower stuff is finally starting to be relevant and usable in production
07:25
<&McMartin>
And of what I consider the Big Three (Rust, Swift, and Go), Rust is the one I feel clearly gets it the most right and is also the one I have the least occasion to actually use.
07:25
<&jeroud>
Rust isn't cutting-edge. It's turning some academic theory into extremely solid engineering.
07:25
<&McMartin>
Yep
07:25
<&McMartin>
But
07:26
<&jeroud>
I have no nice things to say about Go.
07:26
<&McMartin>
It feels very cutting edge because everyone else's languages were designed in the mid-1990s using language theory from the 1970s.
07:26
<&jeroud>
I don't think I've ever even *seen* Swift code.
07:26
<&McMartin>
It has some anomalies that are very difficult to explain if you are not already familiar with Objective-C.
07:27
<&jeroud>
Rust certainly does at least one thing no other production-grade language has ever done before.
07:27
<&McMartin>
But the code itself looks a lot like the various Java-like languages that have tried to replace Java over the years
07:27
<&McMartin>
But it also has to include basic versions of everything Objective-C has, and Objective-C was a hamfisted attempt to shoehorn bits of Smalltalk into C.
07:28
<&McMartin>
Oh, I should actually start putting Kotlin in that list of New Languages.
07:28
<&jeroud>
I've heard about Kotlin, but not looked at it.
07:29
<&jeroud>
I get the impression that it's a reasonable attempt to have a "nicer Java".
07:29
<&jeroud>
But I don't want a "nicer Java". :-P
07:30
<&McMartin>
Mmm
07:30
<&McMartin>
I think Scala is the "nicer Java".
07:30
<&jeroud>
(If I absolutely must be on the JVM, I know where to find Clojure.)
07:31
<&McMartin>
Here is some representative Swift code. https://github.com/onevcat/Kingfisher/blob/master/Sources/Networking/ImageDownloader.swift
07:31
<&jeroud>
Scala is the result of a terrible transporter accident involving Java, OCaml, and a cargo bay full of loose syntax.
07:31
<&McMartin>
"Like I said"
07:32
<&McMartin>
Kotlin is making some attempt to exist off of the JVM [*]
07:32
<&McMartin>
[*] and ART, which is what's going to make it actually relevant, thanks Oracle
07:32
<&McMartin>
But it's not quite there yet.
07:32
<&jeroud>
Does the ? denote "may be null"?
07:32
<&McMartin>
Yes.
07:33
<&McMartin>
And ! in that position means "Didn't explicitly allow that it may be null or is definitely not null, so I won't require you to unwrap it, but I'll crash if you hand it a null"
07:33
<&McMartin>
If it shows up in your type inference it's a sign you didn't annotate your imported C/ObjC code sufficiently.
07:33
<&McMartin>
(Similarly, x as? Type means 'try to cast x to Type and evaluate to nil if it's not that type, while x as! Type means crash/assert if it's not that type)
07:34
<&jeroud>
I wanted to like Scala more than I actually like it.
07:34
<&McMartin>
I didn't even want to like Scala and ended up liking it less.
07:34
<&McMartin>
Kotlin was... smooth, when I experimented with it on some programming challenges
07:34
<&jeroud>
(I don't like Scala very much.)
07:34
<&McMartin>
The thing that jumped out at me was how you mostly didn't write initializers, but instead treated the body of your class definition as if it were a script defining fields and instance variables and methods.
07:35
<&McMartin>
And initializers were only for reacting to particularly exceptional circumstances.
07:36
<&jeroud>
I enjoy comparing Scala to F#, though, because they have very similar starting points and completely different ending points.
07:36
<&McMartin>
And yeah, I have seen nothing about Golang that doesn't tell me that someone decided to go back to 1970s basics and then implement 80s innovations in a way that implied that they'd only head about them fifth-hand.
07:36
<&McMartin>
('Someone' was almost certainly Rob Pike)
07:36
<&jeroud>
They're both "combine ML with Java/C#".
07:38
<&McMartin>
Oh yeah, the other bit on Swift that's wacky and annoying but inescapable
07:38
<&McMartin>
self.delegate?.imageDownloader(self, didFinishDownloadingImageForURL: url, with: value, error: nil)
07:38
<&jeroud>
But where Scala is a transporter accident, F# is a beautifully clean functional language with a no-messier-than-it-needs-to-be glue layer to the rest of the CLR.
07:38
<&McMartin>
Those keyword arguments aren't actually keyword arguments. They're part of the function name.
07:38
<&McMartin>
This is, AIUI, basically Smalltalk's fault by way of ObjC.
07:39
<&jeroud>
I read your iGlossolalia (sp?) post. ;-)
07:39
<&McMartin>
(Also ?. is the 'if the thing on the left is nil, this evaluates to nil, otherwise invoke that method/reference that field' thing.)
07:39
<&McMartin>
Oh right, I did mention in that.
07:39
<&McMartin>
(Nobody actually sat through all of Unfiltered Cocoa.)
07:40
<&McMartin>
Also Swift has one hilarious wart wrt ARC that they solved after a lot of mailing discussion in a way that is both extremely elegant and utterly horrible and it warms my heart-hole
07:40
<&jeroud>
I've been really bad at keeping up with stuff in the past year or so.
07:41
<&McMartin>
A lot of callbacks in ObjC have this issue where you want to call stuff on self, but you're registering a callback that will probably produce a circular reference or live longer than you want the object to, and in particular, if the object dies, you want the callback to self-destruct or at least become a no-op
07:41
<&jeroud>
But I decided I wanted to actually follow the C++ conversation yesterday so I went and read the relevant chapter. :-P
07:41
<&McMartin>
So you do a lot of "__auto_type __weak *weakSelf = self; [thing doThingWithBlock:^{ __auto_type *strongSelf = weakSelf; if (!strongSelf) return; /* ... */ } );
07:42
<&McMartin>
Swift has a convenient but unnesseary construct "guard (expression, possibly with destructuring variable definitions) else { /* block that never exits normally */ }
07:42
<&jeroud>
That looks ugly.
07:43
<&McMartin>
So you can for instance do a safe downcast by putting "guard let x as? Type else { return nil; }" instead of an if and an extra variable declaration.
07:43
<&jeroud>
And also appears to be missing a ].
07:43
<&McMartin>
Probably, yeah.
07:43
<&McMartin>
I'm being lazy.
07:43 * jeroud nods.
07:43
<&McMartin>
So you can mark your block's captures as weak with something like [weak x] to be a weak reference, before your block.
07:44
<&jeroud>
So am I. I should be taking my meds instead of loitering near my desk with my laptop half plugged in.
07:44
<&McMartin>
And then you get [weak self](args) in { guard let self = self else return; /* ...stuff */ }
07:44
<&McMartin>
(also if it isn't super obvious, ObjC and Swift both use `self` to mean what C++ and Java use `this` for.)
07:45
<&McMartin>
I haven't had to actually use any captures yet, so I may have messed up the block syntax.
07:46
<&McMartin>
I think there may be a certain amount of transporter accident going on here too, but it's harder to tell what all got bodged in there.
07:46
<&jeroud>
Closure captures are one of the few things I haven't quite wrapped my head around yet in Rust.
07:47
<&McMartin>
And its most abusive feature, which many designers have gotten excellent mileage out of, is that if the final argument to a function is a callable object, you can put that block outside the call.
07:47
<&McMartin>
Which I guess means Ruby stuck its foot int he transporter, maybe
07:47
<&McMartin>
But man, that makes the ObjC async-io API so much cleaner-looking.
07:47
<&McMartin>
And turns nested-callback hell-pyramids into something that looks more like a chain of else-ifs.
07:48
<&jeroud>
Nah, from what you've said Swift is much more "surgically grafted monstrosity" than "transporter accident".
07:49
<&McMartin>
I have some sketches for a seriously horrific set of interoperations I'd like to do, but I'm not yet at a point where I can attempt it on a real design
07:49
<&McMartin>
Once I do, if it works, my opinion of Swift will rise dramatically in the "you beautiful bastards, you actually pulled it off" sense
07:49
<&McMartin>
And if not, it will probably not be hurt
07:49
<&McMartin>
Failure to clear a bar I consider unreasonably high isn't a demerit even if it would make my life much, much easier =P
07:50
<&McMartin>
(But if it doesn't work, there's a bunch of nearly-identical boiler-plate code I'm going to have to write a program to churn out for me.)
07:50
<&McMartin>
But it's still sketchy enough that I don't have a formal spec of exactly what it is I *want*.
07:51
<&McMartin>
I'll get there.
07:51
<&jeroud>
At which point you may as well be writing Go. :trollface.png:
07:51
<&jeroud>
(Regarding the boilerplate.)
07:51
<&McMartin>
We already have equivalent scripts for autogenerating Java, C#, C++, and JS code.
07:52
<&McMartin>
And Swift will need at least a little bit anyway.
07:53
<&McMartin>
(It's basically generating the code for talking to the server from the server's own code, and the server "owns" that part. So Swift will at least need a file full of declarations. But if this *works*, it will need much less actual *compiled code* generated along with it, because I'll be able to just point to the declarations and {Step 2: ???{ and a few classes in the standard library and That Will Be It.)
07:55
<&McMartin>
(The C++ code is a horrific mess of autogenerated marshalling/unmarshalling code because C++ lacks reflection; the Java code is nothing but declarations and annotations because it has All The Reflection. I've been avoiding writing one for ObjC, but it would end up in between those two.)
07:56
<&McMartin>
Go's marshalling library is super-ad-hoc but would be more towards the Java end than the C++ one, ironically enough.
07:59 Reiver [quassel@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Reblooting.]
08:00
<&McMartin>
Informally, though, the thing that will Make My Life Much Easier is if it's possible to retrofit compliance with Swift protocols onto Objective-C protocols.
08:00
<&McMartin>
I know it's possible with Objective-C *classes*.
08:01
<&jerith>
What is a protocol in this context?
08:17
<&McMartin>
The equivalent of a Java "interface".
08:17
<&McMartin>
Slightly more expressive.
08:18
<&McMartin>
(You will also find "category" and "anonymous category" in ObjC talk; a category is a C# "partial class", which Swift imports as "class extension" and an "anonymous category" is "implementation-private methods and fields it doesn't expose in headers".)
08:21
<&jeroud>
I really like how Rust's traits are a combination of interface and default implementation.
08:21
<&jeroud>
For some reason I didn't like traits nearly as much in Scala. (Maybe because inheritance?)
08:22
<&jeroud>
But it's been a while.
08:23
<&jeroud>
Maybe I should actually look at Scala again now that I've seen how well Rust mixes a traditionally-functional type system with traditionally-OO concepts of encapsulation and access.
08:24
<&jeroud>
(That latter isn't actually what I mean, but I don't currently have the vocabulary.)
08:31 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
08:31 mode/#code [+ao Reiver Reiver] by ChanServ
08:32
<&jeroud>
I guess the difference here is that Scala mixes ML-style functional things with not-quite-Java-style OO things, whereas Rust takes a clean imperative core and carefully adds some ML-style type system and not-at-all-Java-style OO ideas to it.
09:33 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
09:33 mode/#code [+qo Vornicus Vornicus] by ChanServ
09:38
<@abudhabi>
ARGH.
09:38
<@abudhabi>
For the last hour and a half I've been trying to BURN A FUCKING CD.
09:39
<@abudhabi>
How does a technology this mature be so fucking shit nowadays?
09:39
<@abudhabi>
Mint/Xfce, FWIW.
09:40
<@abudhabi>
My Linux desktop - won't even recognize anything's put into the drive.
09:41
<@abudhabi>
My Windows desktop - admittedly, using a redneck setup of CD via USB - won't usually do anything right.
09:41
<@abudhabi>
My Linux laptop - will pretend to burn CDs but won't read non-blank ones.
09:42
<@abudhabi>
So I pretty much have to go to fuckin' town to buy the service of burning a couple of CDs.
09:43
< Mahal>
Why are you trying to burn CDs?
09:44
<@abudhabi>
Contractual requirement.
09:48
< Mahal>
I can't talk Linux, but Windows I can
09:48
< Mahal>
what's the program you're using?
09:48
< Mahal>
and what sort of data? ISO's or just misc data to cd?
09:48
<@abudhabi>
Just the native shit.
09:48
<@abudhabi>
The problem is the setup, I think, because the PC is too new for the drive.
09:49
<@abudhabi>
There are no PATA ports on the mobo.
09:49
< Mahal>
Oh
09:49
< Mahal>
https://cdburnerxp.se/en/home
09:49
<@abudhabi>
So I used a PATA to USB thing.
09:49
< Mahal>
try this
09:49
< Mahal>
the native shit is shiiiiit
09:49
<@abudhabi>
No, I won't waste any more time on trying this. I'm going to town, where I know they can burn me CDs.
09:50
< Mahal>
Or that. -shrug-
09:51
<@abudhabi>
The Windows problem is that the CD drive isn't even recognized as being there half the time.
09:51
<@abudhabi>
And half of the time it is, it either won't read or won't write or both.
09:51
<@abudhabi>
When I could get it to burn, it burnt OK.,
09:52
< Mahal>
(TBH I never felt like optical burning was a mature technology anyway, but YMMV)
10:40
<@TheWatcher>
abudhabi: it probably won't make much difference, and is kinda pointless for rarely-used optical shenanigans, but you can get PATA to SATA adapters that generally work much better than USB gumph
12:56
<@abudhabi>
Could work. Thanks.
12:56
<@abudhabi>
I could also dust off some ancient machine with WinXP and use that.
12:56
<@abudhabi>
Just like they use in the copyshop.
13:03
<&[R]>
Sounds like you're having hardware issues mixed in there
13:05
<@abudhabi>
I can see two problems: a) Mint (which I use for everything) has shit support for CD, b) my Windows box hardware is done poorly.
13:10
<@abudhabi>
Time to buy some converters from China.
13:27
<@abudhabi>
Luckily, I don't have to do this CD-ROM shit more than a few times a year.
14:04
<&[R]>
https://sourceforge.net/projects/txtselect/files/ <-- anyone else having troubles downloading this?
14:05
<@abudhabi>
Nope.
14:05
<&[R]>
Hmm
14:05
<@abudhabi>
Try the direct link? https://downloads.sourceforge.net/project/txtselect/txtselect-1.0.py?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Ftxtselect%2Ffiles%2Flatest%2Fdownload&ts=1569416701
14:08
<&[R]>
<3
14:08
<&[R]>
Never had an issue using a browser to download from SF before
16:22
<@Alek>
Freespace 2 free on GoG
16:25 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
16:25 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code
16:48 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
17:41 Pinkhair [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code
17:43 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
17:49 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code
17:51 Pinkhair [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
18:28
<&jeroud>
abudhabi: A common problem with USB is unpredictable latencies. The protocol makes no guarantees about timing.
18:30
<&jeroud>
I expect an optical burner really wants its write buffer full at all times, and since it's expecting to be on a PATA bus it doesn't have extra buffer for latency shenanigans.
18:32
<&jeroud>
So SATA->PATA is likely to work much better. Likewise for PCIe->SATA, etc.
18:34
<&[R]>
Also each USB port is usually part of a hub
18:34
<&[R]>
Which likely adds problems to that senario
19:41 gnolam [quassel@Nightstar-csto10.cust.bahnhof.se] has joined #code
19:41 mode/#code [+o gnolam] by ChanServ
20:44 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
20:45 Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code
21:58 Degi [Degi@Nightstar-dobggn.dyn.telefonica.de] has joined #code
22:10 Kindamoody[zZz] is now known as Kindamoody
22:18 gnolam [quassel@Nightstar-csto10.cust.bahnhof.se] has quit [[NS] Quit: Z?]
23:20 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
--- Log closed Thu Sep 26 00:00:43 2019
code logs -> 2019 -> Wed, 25 Sep 2019< code.20190924.log - code.20190926.log >

[ Latest log file ]