Hacker Newsnew | past | comments | ask | show | jobs | submit | y0ned4's commentslogin

When I started programming in Haskell, where all variables are immutable, I felt like I was in a straitjacket

Then, suddenly, the enlightenment


How do you know it’s real? When one is in a straitjacket for a long time, the trauma might make the mind disassociate from the body, giving an illusion of freedom.

The brain is essentially dreaming it’s escaped while the body is still programming in Java.


That made me laugh, thank you.


I've had this experience with going from PHP and JS to typed languages. Many years ago I was a type sceptic, but after being forced to use them, I now can't stand not having strict typing.

I'm sure others have written about this, but these days I think good code is code which has a very small area of variability. E.g code which returns a value in a single place as a single type, has a very limited number of params (also of single type), and has no mutable variables. If you can break code into chunks of highly predictable logic like this it's so so much easier to reason about your code and prevent bugs.

Whenever I see methods with 5+ params and several return statements I can almost guarantee there will be subtle bugs.


I initially started programming with C++, then did a bunch of scripting languages and then Rust and C#. I feel like there are pros and cons to strictness.

I don't like all scripting languages, but Python, for example, has a simple syntax and is easy and fast to learn and write. I think it also has a good standard library. Some things can be simpler because of the missing guardrails. But that's also the weakness and I wouldn't use it for large and complex software. You have to be more mindful to keep a good style because of the freedoms.

C++ and Rust are at the opposite end. Verbose to write and more difficult syntax. More stuff to learn. But in the end, that's the cost for better guarantees on correctness. But again, they don't fit all use cases as well as scripting languages.

I've experienced the good and the bad in both kind of languages. There are tradeoffs (what a surprise) and it's probably also subjective what kind of language one prefers. I think my _current_ favorites are Rust, C# and Python.


> Whenever I see methods with 5+ params

I don't see why that's a problem. If a function implements an algorithm with several parameters (e.g. a formula with multiple variables), those values have to be passed somehow. Does it make a difference if they're in a configuration object or as distinct parameters?


Personally I'd tweak your last sentence to "return statements in the middle of a function."

Early returns at the very top for things like None if you pass in an Option type don't increase the risk of bugs, but if you have a return nested somewhere in the middle it makes it easier to either write bugs up front or especially have bugs created during a refactor. I certainly have had cases where returns in the middle of a beefy function caused me headaches when trying to add functionality.


How does Haskell deal with things like memory-mapped I/O or signal handlers where the value of a variable can be changed by factors outside of the programmer's control?


Side effecting computations that depend on the "real world" go into an IO monad. The game in Haskell is shifting as much of the codebase as possible into pure functions/non-side-effecting code, because it's easier to reason about and prove correct.


IORefs usually, which can only be manipulated within the IO monad, so they tend to only get used at the top level and passed down to pure functions as parameters.


The lovely thing with Haskell is you have the ST monad that lets you have as many mutable variables as you want, as long as they stay within ST.


As former physics student, a lot of ego and little physics IMHO. Theoretical physics is pointless without experimental tests. Personally, I prefer physicists spending more time in the lab or in classroom than on mass media


Some degree of engagement with popular opinion and culture might be needed to keep on getting money for the experiments and grants for the students.

But I take the point you are making.


Also physicists tried the "keep out of the public and just do the science* thing and now everybody thinks physics has made no progress for 50 years and the masses think "string theory" is anything more than a topic in some books not aimed at physicists


Experimental tests happen after theoretical physics figured out what tests should be done.


Thanks for sharing this paper


<3


How many homemade chess engines did this paper give rise to... X-D Shannon we miss you


You don't block an entire tram line just because there are pickpockets on board some trams The "solutions" implemented here in Italy are not solutions, but abominations imho


This thread is meandering into Russian examples of government malfeasance which is cool but does everyone know about Operation Gladio in Italy itself?

https://en.m.wikipedia.org/wiki/Operation_Gladio


Nah you fill it up with poison gas because you don’t negotiate with terrorists.



Or the apartment bombings debacle, where the GRU and FSB launched false flag bombing attacks against it's own citizens. Several of them were arrested by police planting bombs. At one point a Duma representative denounced 'breaking news' of an attack by 'terrorists' in a specific location 3 days before it actually happened.

https://en.wikipedia.org/wiki/1999_Russian_apartment_bombing...


This is widely regarded as putin's move to consolidate power.


Justifying oppression through manufactured foreign threats. Still works just as well as it ever has.


Not to mention generating exodi from Venezuela and Syria just so that your puppet candidates in the US and the EU can rally against the "invasion" of refugees.


Letting in a large amount of people to enter a country without the necessary visas, technically is an invasion. Otherwise what's the point of country borders and border enforcement? If strangers could come and go in your house as they please without your permission, that's illegal as well and you'd call the police.


Pretty sure this had nothing to do with trains or negotiating with terrorists. A closer comparison would be a recent event during which a military prevented kidnappings by killing the people who could be taken as hostages.


> a military prevented kidnappings by killing the people who could be taken as hostages.

which events are you talking about?


"Ryazan sugar" is worth a search by itself.


What the fuck


It was pretty fucked up for the government to not coordinate an antidote with hospitals, but other than that, can anybody really be sure that another approach would have resulted in fewer hostage casualties? The terrorists had the whole place rigged with bombs. Considering the circumstance I think the gas was a pretty good idea with a poor followup.


There is a pretty convincing argument made that a less violent foreign policy would have made the terrorist act significantly less likely to happen in the first place.

E.g. https://en.m.wikipedia.org/wiki/War_in_Dagestan_(1999) and the following bombing of Chechnya.


Sure, I buy that. But the guys tasked with responding to that hostage crisis couldn't go back in time and fix Russia's [domestic] policy. They had to deal with the situation they were given.


Both the military "Alpha Group" and "Vympel" were active combatants in both the first and second Chechen wars, they are branches of FSB, which were indeed responsible for the Russian presence in Chechnya since 2001.

Point being, the persons in charge of the the gas and raid in the theatre were also the guys in charge of tactics used in Chechnya.


That may be the case, but nevertheless when they were dealt with the hostage crisis, going back in time and correcting the policy decisions which precipitated it was not among their list of options.

(And were the commanders on the ground that week actually in decision making positions during the Chechen conflict? 'Following orders' doesn't excuse their participation, but it seems unlikely they personally were ever in a position to stop the conflict.)


It's less work for sharers of links to remove m. from their URLs than it is for everyone on a desktop to do so.


It was not a terrible approach, the use of "poison gas" is a bit of a misnomer. They weren't dousing the theatre with chlorine and melting everyone's lungs for example. It was not deadly poison gas, it was "get high" poison gas. That unintentionally made some people get so high that they died in a state of euphoric bliss.

The gas, high speculated but nobody 100% sure, is thought to be basically super-fentanyl. Fentanyl itself is like hyper powerful heroin, and this stuff was hyper powerful fentanyl. But not fatal per se, certainly intended not.

So all this hubbub about the theatre gas isn't so bad. Per capita if you just walk down the sidewalk in San Francisco's Tenderloin district, you would be exposed to more fentanyl fumes than you would have in that theatre. In the tenderloin residents talk wistfully of the the theatre gassing with superfentanyl, wishing they could have partaken in that bliss. If they had taken a good dozen people off the tenderloin and sent them to the theatre they easily would have smoked it up with between 100 and 1000x times the concentration of opioid fumes.


Yeah, maybe you're right. Excluding the "less violent foreign policy" sibling comment that is also correct, given that the situation had already started, I guess gas isn't a terrible way to handle the situation.

Really terrible about not coordinating with the EMTs, though. They could have saved hundreds of people if they'd just carried Narcan.


This isn't a good analogy because the people being pickpocketed and the people on the trams are the same people.

A better analogy is blocking the tram line because it interferes with some guy's antiquated business model.


That is not an useful analogy, because as far as government is concerned, you just made an argument in favour.


Well, yes, but whether the government should be propping up antiquated business models is the question. The government needs to work for the people, not the oligarchs. There might very well be an argument that government should "stop the tram" because it's interfering with another business that is good for the people. But copyright has long been for the oligarchs, not the people.


So police should not close entire co-consignment flea market if a stall is found selling drugs there?


Correct. A single stall is a single stall.


the same here XD


Using the cloud = losing your know-how + gaining vendor lock-in


Some people even say 'cloud == deskilling'.


How touching to read so many appreciative comments A life well spent RIP Lynn, may the earth be light on you


// Function to pop a value onto the stack this.pop = function() { this.stack.push(); };

I think he made some mess with his code X-D


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: