6,801 karma · joined Feb 26, 2009 (17y ago) · 1,367 submissions
comment 7y ago · link · parent
Many people have pointed out that C++17 has std::optional. While that's true, I don't think it'll deprecate raw pointers. I'll try to explain why.
Here's an example you can paste, compile and run:
#include <iostream>
#include <memory>
struct foo
{
int thingamajig;
};
void borrow_optional_foo(foo * borrowed)
{
if (borrowed != nullptr)
{
borrowed->thingamajig = 42;
}
}
int main()
{
std::unique_ptr<foo> owned = std::make_unique<foo>();
owned->thingamajig = 17;
std::cout << owned->thingamajig << std::endl;
borrow_optional_foo(owned.get());
std::cout << owned->thingamajig << std::endl;
return 0;
}
If you run it, it should print: 17
42
What would it look like if we wanted to use std::optional and get the same behavior? #include <iostream>
#include <functional>
#include <memory>
#include <optional>
struct foo
{
int thingamajig;
};
void borrow_optional_foo(std::optional<std::reference_wrapper<foo>> borrowed)
{
if (borrowed)
{
borrowed->get().thingamajig = 42;
}
}
int main()
{
std::unique_ptr<foo> owned = std::make_unique<foo>();
owned->thingamajig = 17;
std::cout << owned->thingamajig << std::endl;
borrow_optional_foo(std::make_optional(std::ref(*(owned.get()))));
std::cout << owned->thingamajig << std::endl;
return 0;
}
As you can see, there's a tradeoff involved. On the one hand, you get crystal clear, descriptive type: std::optional<std::reference_wrapper<foo>> is clearly an optional reference to foo.On the other hand, using it is absolutely atrocious: you have to write borrowed->get().thingamajig as opposed to borrowed->thingamajig, and std::make_optional(std::ref(*(owned.get()))) as opposed to owned.get()
Does it work? Absolutely. Is it crystal clear? Indisputably so. Will it deprecate raw pointers? I really, really doubt it, but that's just my opinion.
comment 7y ago · link · parent
std::unique_ptr<foo> m_foo;
How do you pass that into a function that can receive a pointer to foo, but does not require it? The only way to do so is to declare the function to take a foo* and pass it m_foo.get()In summary, * will never be deprecated until C++ has support for something along the lines of Rust's borrowing and lifetimes.
comment 7y ago · link · parent
I had just moved to United States with my wife and my 7-year old son. Since this was the second time I had moved from one country to another, I expected to be able to handle it reasonably well. Instead, I got seriously depressed by the absence of my friends and the cultural paradigm shift (i.e. the Seattle Freeze). I also had to deal with my family's emotional fallout -- both my wife and my kid got depressed and I was trying to help them as much as I could. On top of it all, I got an abscess and had to go to ER. As a result, my productivity dropped to zero.
The problem wasn't the productivity itself, but that I had mismanaged the situation. Instead of trying to talk these things over with my manager, I kept pushing myself, promising to deliver and failing to do so. It came to a point where my manager scheduled a 1-on-1 with me and told me he had no option but to put me on a PIP. He said he was extremely perplexed, because he had formed a completely different image of me during interviews and thought I would perform much better. During the 1-on-1, he kept prodding me to explain what was going on, until I broke down and explained the situation. He asked me why I hadn't told him any of that before. I explained that I had thought the American corporate culture was that you're expected to leave your baggage at the door and that nobody else should pick up your slack -- you're here to work, not to be babysat. He was appalled by the idea and explained that I should've talked to him and we could've organized things better. He reiterated that, because my lack of performance had percolated up the food chain, he had no option but to place me on a PIP; it wasn't merely up to him anymore. He explained that a PIP was a chance to prove that I really was capable of fitting my role and that if I met the PIP goals I would be in the clear, not just with his team and at that moment, but in the future too - managers aren't allowed to hold your PIP against you.
We then sat down and worked out a PIP. During the following 6 (or was it 8?) weeks, I met all the goals and that was that. After 2 years of working on that team, a much more exciting opportunity for internal transfer opened up, I applied for it and it worked out great. Nobody even mentioned my PIP.
In my opinion, that's how a PIP is supposed to work. For anyone interested, the company in question was Amazon. There are lots of things one might criticize about Amazon, but this is one thing they did absolutely right.
comment 7y ago · link · parent
I find voice assistants to be of very limited use to me. Generally, I prefer typing, because it's just faster. When I find myself needing a voice assistant, it's because I'm: 1) not near enough a keyboard, and/or 2) using my hands for something else, namely cooking or driving. Back when I had Echo Dot, it wasn't really useful for cooking, other than setting timers. And, of course, I couldn't take it with me in my car. I don't know if they made it more useful in the last couple of years.
I think voice assistants could be extremely useful, but they're being hampered by their creators' ambition. Every single voice assistant I've seen is trying too hard to be "everything you'll ever need", so it could dominate the market.
I had hopes for Mycroft II, because it promised to be an open source solution on par with other voice assistants. It turned to be a typical Kickstarter horror story: overpromised and not yet delivered.
comment 7y ago · link · parent
What does that leave? I don't pay for YouTube, for example. Not that I care that much, because the stuff I watch on YouTube is mostly not the stuff I would miss. The stuff I would miss would probably be available even if YouTube didn't exist (e.g. Zero Punctuation).
Since we're talking about paying, here's another question: do I resort to piracy? Yes, because there are often good reasons to do so.
Movies and shows? Netflix and Amazon mostly don't have subtitles in Spanish, so when I wanna watch something with my wife, sometimes the only way is to download it.
Music? I'd love to be able to come to some agreement with Spotify that lets me save a number of songs a month or a year and let them be mine, so they'll never disappear from my playlist just because Spotify pulled them.
Books? Usually the first book I read from an author I haven't read before is a book I'll pirate. If it's good, I'll buy it and buy that author's subsequent books. We used to use libraries for that kind of stuff.
As you can see, most of those problems aren't solvable by ads.
Here's a question for you, though: do you think Wikipedia would be better off with ads?
comment 7y ago · link · parent
The conventional wisdom is that ads are more convenient. I hope that, sooner or later, this will stop being true and we'll have a variety of better ways of supporting content.
comment 7y ago · link · parent
comment 7y ago · link · parent
There are other ways to get money to support your work, and if those ways are too painful right now, that's just an opportunity for disruption. Even better, it's an opportunity to prove that disruption doesn't have to be exploitative.
comment 7y ago · link · parent
comment 7y ago · link · parent
The atrophy of real-world relationships he mentions is not something he made up, but rather a real problem. And I would be surprised if someone could prove that this problem doesn't contribute to teen suicide rates at all.
comment 7y ago · link · parent
First of all, before even clicking through, my reaction to the name was negative. To quote henrikberggren's comment: "Naming a learning platform 'Sugar' is like naming a rehab clinic 'Heroin'."
Second, those stick figures look like skull-and-crossbones.
Third, your sample "fun activity" looks less fun than anything a kid with a computer has access to.
Fourth, creating a new user in your Sugarizer demo is an awful experience. It asked me to pick a name first, then let me go through the rest of the steps -- including "choosing" a new avatar color by clicking to get random colors until I just gave up -- and then, at the end, told me the user "foo" already exists.
Fifth, I don't find the UI intuitive at all. When I'm inside an activity, if I want to go back to the activity selection page, I have to click on an octagon with a square inside it. No idea how I'm supposed to associate that with "home" or "back" or any of the verbs I could think of.
Lastly, I tried out a few of the activities and I have no idea how any of that is supposed to help kids learn or collaborate. The "clock" activity just displays a clock. That's it. The "tam tam" activity has a confusing UI, but once you overcome the confusion, you can just pick different instruments to hear their sound. The most confusing was the "maze" activity, because I pressed one arrow key and it solved the whole maze. Later I realized that it follows the path until a decision point and then waits for input, but it's really weird.
I appreciate that this must have taken substantial effort, but I have no idea just how this is supposed to be useful. And let's face it, I gave it more time than an average visitor probably would.
comment 7y ago · link · parent
I understand that it's convenient because you get money without asking your end users for it. But I've always thought of it as "if it seems too good to be true, then it probably isn't" and stories like yours just keep reinforcing that feeling.
And all that's without considering how ads degrade the user experience or help erode the privacy. Every time I have to browse the web without an adblocker, I get freshly shocked at how awful it is.
comment 7y ago · link · parent
These days, I'm getting a sense of deja vu, because Google is slowly getting worse and DDG is slowly getting better. Most of the time, I'll get the desired result right away, regardless of the engine I use. But sometimes, I'll be surprised at how bad the results are on one and then I have to try the other. And although it's not happening very frequently, I have to do it more and more often.
I guess that's good, in a sense. Sure, it's nice when things just work and you don't have to think about them, but we've all seen that lack of competition is, in the long run, bad for the users.
comment 7y ago · link · parent
Different ages have different priorities. The best way to attract kids to any activity, including programming, is to give them something fun to do. Let them make crappy stuff that's flashy and fun. If they choose to stick with it, teach them to do it well and help them unlearn the bad habits.
Incidentally, I consider bad habits to be incredibly important. Yeah, sure, you can read about how to program well, but it's not the same as having your own bad habit bite you in the ass and learning from it. It's even better if you learn bad habits and then unlearn them while you're still young and not when it might impact customers.