:fa_youtube_play: Cool Computing Videos
-
I'm scaled at 100%. It's an optical illusion caused by the way some monitors refresh.
-
It's an optical illusion caused by the way some monitors refresh.
It's not just the monitor.
-
Why does the background of that image turn blue when I am scrolling, being gray otherwise?
If I scroll with the mouse wheel, it's fine, but if I drag the scrollbar...it flickers red!?
-
If your screen is travelling towards you at several thousand kilometers per second, the color aberrations on Mac OS desktops are probably the least of your problems.
-
Just tried on my Chromebook which has super smooth two-finger scrolling, and it flickers gray. The color depends on the monitor and if you have F.lux installed, but the flicker depends on how fast it scrolls.
-
Someone needs to set up an Old School Mac, get it on the Internet, get it on Discourse, and scroll.
Have a fire extinguisher on hand.
-
What? It's the desktop background pattern that acts weird when moving on a screen, not the mac screen itself.
-
What? It's the desktop background pattern that acts weird when moving on a screen, not the mac screen itself.
I know. I just want to see the picture all fucked-up like on a Classic Mac. What? I have some very weird fetishes and really, really need a release. Help.
-
Whatever fancy concurrency mechanism you use, threads are somewhere underneath it all.
If you do
env GOMAXPROCS=1 ./my-go-program
, it won't spawn any threads.
-
Surely that will spawn at least one thread.
# env GOMAXPROCS=1 ./my-go-program
There. That ought to fix it.
-
I think it's debatable whether the main thread counts as spawning a thread or not. In some systems the main thread is 'special'.
-
@Lorne_Kates said:
Someone needs to set up an Old School Mac, get it on the Internet, get it on Discourse, and scroll.
... why does somebody need to do that?
-
@Lorne_Kates said:
Someone needs to set up an Old School Mac, get it on the Internet, get it on Discourse, and scroll.
... why does somebody need to do that?
To see what your screenshot will look like. It's the law.
-
@Lorne_Kates said:
Someone needs to set up an Old School Mac, get it on the Internet, get it on Discourse, and scroll.
Have a fire extinguisher on hand.
-
-
For node.js aficionados.
https://www.youtube.com/watch?v=O1YP8QP9gLA
These guys are operating on a different level.
-
Guy behind meteor analyzes the state of IT today and where does he see it going. Interesting.
-
Didn't JavaScript already die?
-
[] + {} = wat?
-
Very cool video about Electron, the framework behind Visual Studio Code.
https://www.youtube.com/watch?v=OHOPSvTltPI
I'm excited. Can't wait to clear up some time and try playing with this.
-
I'm sorry, but I can't look at that thumbnail without singing:
"Amy Palamountain
From a little hill
Amy Palamountain
Least I hope I will"....
-
Here's another guy railing against OOP, this one championing procedurial programming.
Some solid advice. Some dubious.
-
Some solid advice. Some dubious.
a = use x, y { ... // return from the use block return 3; }
I want this. I frequently find myself writing code like this and get frustrated when I can't just make it work like the above.
-
a = ((xArg, yArg) => { //... return 3; })(x, y);
That's nasty, though.
-
What's so bad about
a = 3;
?
-
I want this.
I've got this in my code. It really really helps. The syntax is slightly different (for a bunch of reasons that don't matter here) but being able to keep state changes localised is ever so nice.
I like objects a bit more than the guy in the video, but largely agree with most of what he says. The main thing I disagree with is over the perfect encapsulation of state, where he claims that it means having to direct everything through mega-god objects (before pointing out that it's ridiculous). Encapsulation of responsibility works better. But the consequences of my difference of opinion aren't really very significant; I still recommend not being a slave to the Elder God of Object Orientation.
-
-
```cs
a = ((xArg, yArg) =>
{
//...
return 3;
})(x, y);That's nasty, though.</blockquote> --- Hold my beer: <img src="/uploads/default/original/3X/d/3/d39f2e34b8894f8f859ee6970c237d0453ad339d.png" width="427" height="196"> Well, that's disappointing.
-
But seriously, what the guy from the video was talking about, and I believe @LB_ too, is the ability to create nested scopes where the variables from the outer scope aren't accessible inside the inner scope:
-
-
I've got this in my code.
Here's a free sample:
proc use {args body} { tailcall apply [list $args $body [uplevel 1 {namespace current}]] \ {*}[lmap v $args {upvar 1 $v a;set a}] }
In use:
proc foo {} { set x 2 set y 3 set z [use {x y} { incr x $y incr y $x puts x=$x,y=$y return [expr {$x+$y}] }] puts x=$x,y=$y,z=$z } foo
Which prints:
x=5,y=8 x=2,y=3,z=13
I guess that's working then.
-
what the guy from the video was talking about, and I believe @LB_ too, is the ability to create nested scopes where the variables from the outer scope aren't accessible inside the inner scope:
Actually after sleeping on it I realize C++ already has this:
auto a = [x, y] { //only x and y are accessible return x+y; }();
Guess I forgot about lambdas.
-
But seriously, what the guy from the video was talking about, and I believe @LB_ too, is the ability to create nested scopes where the variables from the outer scope aren't accessible inside the inner scope:
You can do that in C#. It's a little more verbose.
Yeah like aliceif did. I can't quote her because there's no text in her post and Discourse sucks.
-
You can do that in C#. It's a little more verbose.
Yeah like aliceif did. I can't quote her because there's no text in her post and Discourse sucks.
I think the point is to have a lambda which isn't allowed at all to capture the outer scope's variables, and AFAIK you can't force the C# compiler to complain when you reference something from the outer scope.
-
Why don't you just make a method?
Like, I get what you're saying, but I don't get the point of it. The language already has methods.
And at some point, you're not saving any typing by using the lambda solution.
-
Why don't you just make a method?
-
Well then explain the point of it.
Look, language designers aren't just going to slap in stuff willy-nilly. It has to have some kind of positive impact.
-
Well then explain the point of it.
That video (the one posted by @cartman82 that all this discussion follows on from) explained it. It also goes on rather a lot, so you can probably skip watching it if you don't really care. The point is to create an inner scope that has a copy of selected variables and nothing else from the outside so as to limit the amount of code that needs to be read to understand what is going on without having the overhead of sprawling call-graph spaghetti that doing it all with ordinary functions or methods would tend to have.
-
Well first of all, use an IDE you idiots. (Right-click method name, "Peek Definition", bam, it's right there in the same window.)
Secondly, it sounds like the real problem to be solved here is to be able to define a method within a method. You can already do that in some languages, like JavaScript (although scope-wise I'm not sure what happens.)
I get what you're saying, but if the lambda does something complex-enough that there's risk you might accidentally go outside of its scope, then I think you want a method. Lambdas are supposed to be super-short "one and done" type pieces of code.
-
I get what you're saying, but if the lambda does something complex-enough that there's risk you might accidentally go outside of its scope, then I think you want a method.
The thesis of the author of that video was that there was a need for something part-way between usual local scopes and lambdas. Semantically, they're really single-use lambdas with a selective rule for handling import of external variables. Syntactically, they're a special type of local block (that would be easy to convert into a method/function if you needed it from two places).
The video is overlong (he could have said everything that needed to be said in 15 minutes, instead of using a 45 minute diatribe) but quite good. It's certainly a reasonable argument for a new form of control structure; those are fairly rarely found. What I like most of all is that people have not stopped searching for control structuresâŚ
-
The video is overlong (he could have said everything that needed to be said in 15 minutes, instead of using a 45 minute diatribe) but quite good. It's certainly a reasonable argument for a new form of control structure; those are fairly rarely found. What I like most of all is that people have not stopped searching for control structuresâŚ
Funny thing is, the bulk (and the main point) of his video is his rant against OOP. That whole control structure concept is just a little tidbit he threw in at the end.
-
although scope-wise I'm not sure what happens.
It ends up being a closure, so it has access to the outer scope.
-
Why don't you just make a method?
So that you don't accidentally refer to instance/static fields?
*shrug* Beats me, really. But I'm not a big fan of this kind of code inlining in the first place.
-
I get what you're saying, but if the lambda does something complex-enough that there's risk you might accidentally go outside of its scope, then I think you want a method. Lambdas are supposed to be super-short "one and done" type pieces of code.
Well, there's the issue of using lambdas inside async or inside loops where the value of the outer variable varies.
What do you think happens if you do this?
var strs = new string[] {"one", "two", "three" }; var lambdas = new Func<string>[strs.Length]; for( int i = 0; i < strs.Length; ++i ){ lambdas[i] = () => strs[i]; } for( int i = 0; i < lambdas.Length; ++i ){ lambdas[i]().Dump(); }
It might be different from what you think.
-
It might be different from what you think.
I think it generates a read off the end when evaluating the first lambda in the array. Because of course it does! It's the most annoying possible interpretation, so that's what happensâŚ
Copying closures are easier to understand and use predictably, but less common (for various reasons to do with value/reference models).
-
Like I said, I get the concern, I just don't think it's that big a deal and it's easily fixed with existing tools. This is one of those "we need the feature because I don't use an IDE or I use a shitty IDE".
-
Why would the IDE be doing the compiler's job? Enforcing variable access should be a compile error, not a stupid IDE style warning.
-
Why would the IDE be doing the compiler's job?
It wouldn't. Look, the request here is:
"I want to create a function with an entirely new scope in an existing function"
And I'm saying an IDE handles that request by having the ability to pop-open the function definition right there in the same window as the parent function you want to see it in.
I'm guessing the morons who make long rant videos against OOP are hipsters who don't use IDEs, though.
Enforcing variable access should be a compile error, not a stupid IDE style warning.
And it would be, since your "inner function" would be an entire method with its own scope, all nice and neat.
-
And I'm saying an IDE handles that request by having the ability to pop-open the function definition right there in the same window as the parent function you want to see it in.
In the video he specifically calls out this practice of creating many one-time-use functions that don't really make sense on their own and can't be used in other contexts. The point is that it makes sense to segregate the code but it doesn't make sense to give it full independent function status.
I'm guessing the morons who make long rant videos against OOP are hipsters who don't use IDEs, though.
In the video he specifically mentions several things that IDEs should be able to do for you.
And it would be, since your "inner function" would be an entire method with its own scope, all nice and neat.
No, it wouldn't because it would have access to member variables.
-
What's so bad about
a = 3;
?It's not enterprise, though, is it? What if the value of 3 changes?