Profit is literally the return on investment. Would you invest your money in a startup that guaranteed no profit?
Profit is essentially interest. The only reason new and growing companies get funded is because the EV of future profits (including the probability of losing everything) is higher than just stuffing that same money in S&P 500.
Swift user here: I have to say one of the best features of Swift is the exception handling. Which is to say, exceptions in Swift are not C++/Java/Obj-C style exceptions, but instead are a way to return an error result from a function. And Swift enforces that the error is handled.
That is, a `throw` statement in Swift simply returns an `Error` value to the caller via a special return path instead of the normal result.
I saw that in Swift, a method can declare it throws an exception, but it doesn't (can't) declare the exception _type_. I'm not a regular user of Swift (I usually use Java - I'm not sure what other languages you are familiar with), but just thinking about it: isn't it strange that you don't know the exception type? Isn't this kind of like an untyped language, where you have to read the documentation on what a method can return? Isn't this a source of errors itself, in practise?
> isn't it strange that you don't know the exception type?
Java experience taught us that, when writing an interface, it is common not to know the exception type. You often can’t know, for example, whether an implementation can time out (e.g. because it will make network calls) or will access a database (and thus can throw RollbackException). Consequently, when implementing an interface, it is common in Java to wrap exceptions in an exception of the type declared in the interface (https://wiki.c2.com/?ExceptionTunneling)
Yes I know Java and the challenges with exceptions there (checked vs unchecked exceptions, errors). But at least (arguably) in Java, the methods (for checked exceptions at least) declares what class the exception / exceptions is. I personally do not think wrapping exceptions in other exception types, in Java, is a major problem. In Swift, you just have "throws" without _any_ type. And so the caller has to be prepared for everything: a later version of the library might suddenly return a new type of exception.
One could argue Rust is slightly better than Java, because in Rust there are no unchecked exceptions. However, in Rust there is panic, which is in a way like unchecked exceptions, which you can also catch (with panic unwinding). But at least in Rust, regular exceptions are fast.
> And so the caller has to be prepared for everything: a later version of the library might suddenly return a new type of exception.
But you get the same with checked exceptions in Java. Yes, an interface will say foo can only throw FooException, but if you want to do anything when you get a FooException, you have to look inside to figure out what exactly was wrong, and what’s inside that FooException isn’t limited.
A later version of the library may suddenly throw a FooException with a BarException inside it.
What I liked about Bosst's error_code[1], which is part of the standard library now, is that it carties not just the error but the error category, and with it a machinery for categories to compare error_codes from other categories.
So as a user you could check for a generic file_not_found error, and if the underlying library uses http it could just pass on the 404 error_code with an http_category say, and your comparison would return true.
This allows you to handle very specific errors yet also allow users to handle errors in a more generic fashion in most cases.
I say limited because the compiler doesn't (yet, as of 6.2) perform typed throw inference for closures (a closure that throws is inferred to throw `any Error`). I have personally found this sufficiently limiting that I've given up using typed throws in the few places I want to, for now.
Typed exceptions are unlike typed parameters or return values. They don’t just describe the interface of your function, but expose details about its implementation and constrain future changes.
That’s a huge limitation when writing libraries. If you have an old function that declares that it can throw a DatabaseError, you can’t e.g. add caching to it. Adding CacheError to the list of throwable types is an API breaking change, just like changing a return type.
Swift has typed errors now, but they shouldn’t be used carefully, and probably not be the default to reach for
I don't think it's strange at all--my main uses of the returned errors are
1a. yes, there was some error
1b. there was an error--throw another local error and encapsulate the caught error
2. treat result of throwing call as `nil` and handle appropriately
I don't think typed throws add anything to the language. I think they will result in people wasting time pondering error types and building large error handling machines :)
When I used Java, I found typed exceptions difficult to reason about and handle correctly.
Another really nice thing about Swift is that you have to put the `try` keyword in front of any expression that can throw. This means there's no hidden control flow: if some function call can throw, you're informed at the call site and don't have to look at the function declaration.
From what I can read Swift gives you a stack trace which is good. At the moment I’m using Go where that stack is only generated where the panic is triggered, which could be much higher up. Makes it a lot more unwieldy to figure out where an error happens because everyone uses:
When you call code that can throw (return an error via the special return path) you either have to handle it or make the enclosing context also throwing.
Assuming `canThrow()`, a function that might throw an `Error` type:
func canThrow() throws {
...
}
Call canThrow(), don't handle errors, just rethrow them
func mightThrow() throws {
try canThrow() // errors thrown from here will be thrown out of `mightThrow()`
...
}
Alternatively, catch the errors and handle them as you wish:
func mightThrow() throws {
do {
try canThrow()
} catch {
...handle error here
...or `throw` another Error type of your choosing
}
...
}
There are a few more ways to handle throwing calls.. For example
- `try?` (ignore error result, pretend result was `nil`)
Swift doesn't capture a stack trace in the `Error` object, but Xcode can break when an error is thrown if you set a “Swift Error Breakpoint”, and the debugger will show you the stack trace. Under the hood it just sets breakpoints on the runtime functions `swift_willThrow` and `swift_willThrowTypedImpl`.
that sounds very similar to noexcept(bool) to me, except that noexcept can be computed, for example by deriving from some generic trait, and we presume throws unless specified non-throwing by noexcept.
Someone posted here, thanks for that!! It immediately reminded me of HAML: https://harcstack.org/
I like HAML a lot, it was the most pleasant to develop with. And it shares a lot in common with Stylus. They both shared things in common.
NO NEED FOR: Curly braces, parentheses and semicolons. The cool thing, it was all optional and I wasn't forced to make use of all shortcuts!
I developed my own CSS Framework in 2003, shared with some UX guy at Yahoo, who incorporated it into YUI mostly as is, after I waived all rights. Most of that became internet standard. Later I had my own PHP based CSS scaffolding framework in 2005 that could also generate grids (before flex-box). SCASS/LESS was really similar to my framework, when it came out.
But I disliked it, it just looked like PHP mixed with CSS. I thought why accept the ugly syntax, despite a compiler being available?
Meta, but I've personally switched to a proportional font for my coding. Heresy, I know, but it feels wrong to have to look at code as if I'm coding on an 80 column terminal in 1960.
Most Americans barely know their own country history.
The US has already had a war on drugs. They killed Escobar. They killed everyone else on the list. They won every battle.
And they lost the war. Spectacularly.
If these people were truly enemy combatants, you would think we would (at the very least) round up the survivors and conduct trials in the us instead of just letting them go.
Enemy combatants to...what? When has congress declared war? Using your military to assassinate another countries civilians is a literal war crime under customary international humanitarian law.
Crimes (alleged) on the high seas have a very long history of being prosecuted under their own set of rules. Look into it, you may be surprised what is “normal”
What I believe you're referring to is piracy, not drug smuggling. The term is Hostis humani generis - or enemy of mankind.
There is a very long tradition of treating pirates as outside of all laws because pirates would murder and pillage in one jurisdiction or on the high seas and then sail away to another jurisdiction. So all nations had a duty to confront pirates. That is not to say that summary execution was considered normal - it happened, but typically pirates were captured and afforded some due process.
In the modern era this logic has been extended to terrorism and certain crimes against humanity like torture.
It has NOT been extended to encompass drug trafficking. If you're smuggling drugs from Venezuela to Trinidad, you really don't want to be detected, so you're not going to stop any random ship that you see and murder the crew and steal the cargo. The whole concept of the pirate as someone who is waging war on humanity with extreme violence and can't be effectively dealt with by the nation that is effected doesn't really apply neatly to this situation.
You could make the argument that because drugs are dangerous, and drugs can be transported anywhere, that drug traffickers are effectively enemies of humanity who are doing extreme violence in the same vein as terrorists and pirates. But that would be a novel argument, not, in any way, "normal".
> If these people were truly enemy combatants, you would think we would (at the very least) round up the survivors and conduct trials in the us instead of just letting them go.
What? The whole point of the "enemy combatant" designation is to say that they're not criminals and not PoWs either. I don't like it but it was the standard position under Bush, Obama, and Biden, there's nothing new here.
as a simplest thing, i would expect them to abduct the survivors and bring them to the US to face some trial, rather than putting them on a boat back home
as a general best practice, id expect them to send a patrol boat to go board and confiscate the drugs, then show off said drugs.
its not hard to collect the evidence of drugs, since the drugs will be on the boat/sub, and with the size of the deployment, there's more than enough capacity to just sail over to it, rather than destroying it with missiles.
The goal is kinetics and beautiful fireworks for the folks back home. "Acting now" is much easier than methodical interdiction, investigation, and potential justice. The home audience won't tolerate anything smacking of evidence and proof, that's too bookish and takes time.
No, no one at the highest policy/government levels is doing anything about that. It would require treating drug addiction as a health care issue, with a plan to solve the underlying root causes, support and care for the affected and substantial funding on the ground level for support networks and other institutions that actually work in the space. Housing programs and drug decriminalization may also be worthwhile evaluating.
But that’s hard, unglamorous work, out of the limelight with people that are sick, addicted, grimy. No spectacular fireworks.
>> care for the affected and substantial funding on the ground level
Not sure what you would expect, but on a state level. My state has hundreds of millions in funding for free clinics, free treatment centers, free methadone clinics, free housing, and free welfare. If people really want to get clean, they can.
This isn't a problem of funding either on the state or federal level, its a bunch of NGO's getting rich making sure the situation continues by handing out free tents, clean needles, narcan and "safe zones" where people can do their drugs without interference.
When you make it easier to stay addicted and homeless? Those who are in that situation will continue to take the easy route. Its not easy getting clean and this is 100% on the individual to make the choice to get clean. When you encourage addiction and make it socially acceptable, is it any wonder this issue isn't getting any better and in fact, is well past a crisis point now.
> its a bunch of NGO's getting rich making sure the situation continues by handing out free tents, clean needles, narcan and "safe zones" where people can do their drugs without interference.
There will also be those who try to take advantage of government funding. But the gross handouts to the Pentagon, we can and do audit NGOs. I doubt fraud is the biggest issue here, but if you have studies, please share them.
> Those who are in that situation will continue to take the easy route
Are you saying it's a personal choice and not a mental health problem?
> When you encourage addiction and make it socially acceptable
I don't understand how spending money on housing and addiction treatment is doing that. If you want to encourage addiction and make it socially acceptable, you just don't spend money on housing or treatment.
Its also not hard to see the video of a fast boat with two to four huge 250HP outboard motors and the entire hull filled with huge light colored bales of something and conclude this is not a fishing boat and these are not fishermen who are transporting their catch for the day back to the port.
Perhaps, but even if it's evident that the boat itself is engaged in drug smuggling, that doesn't mean that the people on the boat deserve summary execution. They could be being coerced for instance.
Also, IIRC the first strike killed 11 people. Why would you need, or want, 11 people to crew a fast boat that's supposed to be clandestine. Is it possible that they were smuggling people instead of or in addition to drugs? In which case, maybe we just killed some migrants who wanted to get out of Venezuela.
So your theory is that a dominant military force is using a missile that costs at least 5 figures on random fisherman, with no intel or reason for targeting... Forgive me for thinking that it might be a bit more nuanced than that.
So pick Venezuela? Which at best is a transshipment point, why no strikes in the Darién, why not take out some railroad tracks since a lot of drugs go up from coca country by rail? Also drug smugglers aren't stupid, why would they send product out knowing the U.S. military is sitting out there with a toddler's finger on the trigger?
Know what Venezuela has a shit-ton of though? Oil. Guess who loves the oil, gas, and coal industries? If your answer involves someone orange you'd be right. Guess who got kicked out of Venezuela when Chavaz took over? If you said large multinational oil corporations you'd be correct.
On top of that donnie gets to look tough against a country that largely has no serious regional allies in fact I believe a lot of them are pissed, China has ties but they aren't going to ratchet up the trade fiasco over Maduro, russia is a bit busy punching itself in the balls and last I check Venezuelans aren't big fans of Maduro so donnie is basically riskless save domestically.
Also given the size of those boats I'd wager a solid amount on the total lost amount would be equivalent to taking out 8 McDonald's store shipments and claiming you've dealt a serious blow to McDonald's bottom line.
People need to retire the oil argument, it isn’t credible. We don’t live in the 1980s. The US has been the world’s leading oil producer for years now, is expected to maintain that position for the foreseeable future, and has several trillion barrels equivalent of hydrocarbon reserves.
Venezuela’s oil production is a single digit percentage of US oil production and the quality of their crude is famously poor. The US neither needs it nor wants it except to the extent they pay the US to refine it for them because they don’t have that ability.
Pinning this action on a desire for oil is a lazy argument far past its expiration date.
So your argument is my argument is old? Why were there oil corps there and why were they so pissed when they got kicked out?
Also did you think I was suggesting the U.S. govt wants it? Donnie's friends in the oil industry want it, single digit, double digit, doesn't matter to them greed knows no bounds with that crowd and this isn't Iraq in 2004 under Bush which I never believed had anything to do with oil.
My argument is that it seems like you haven’t updated your understanding of oil geopolitics for several decades.
The US has always had significant control over Venezuelan oil production because the US runs some of the only refineries that can process that type of low-quality crude. If the US banned Chevron from refining Venezuelan oil in the US, Venezuela has few other options. The US already captures much of the value of Venezuelan oil production because of the refinery monopsony. There is little margin in the rest of it. They’ve been profit-maxxing Venezuelan crude for decades.
Your argument could have been reasonable a few decades ago in a “big picture” geopolitical sense but we don’t live a few decades ago. OPEC no longer controls oil prices and the US is the uncontested oil producing superpower. No one saw that coming. Pretending all of this history never happened isn’t going to lead to rational conclusions.
The US used to expend a lot of power ensuring its oil supply. It hasn’t needed to do that for a while. Now it expends power to control oil supplies to other countries. None of this applies to Venezuela though because Venezuelan oil has a dependency on US refineries that other oil producing countries don’t have.
> My argument is that it seems like you haven’t updated your understanding of oil geopolitics for several decades.
Your argument, then, is the GP has a more recent and up to date grasp of geoplotics than the current POTUS?
The same POTUS with a 1930s grasp of tariffs?
What reason exists for the US to "bail out" Argentina? Was that as simple as extending time for those who contributed to the Presidential library fund to claw back their money from Argentina?
Modern geopolitics is all very well and good, but it falls well short of explaining some of blatently century old banana republic stuff going on in the current US administration.
To be more specific, it shot down a balloon from a hobby balloon club, which is built similar to a child’s balloon insofar as it has the same material.
On the heels of the Chinese balloon incursion it might be understandable why they would shoot down a high altitude balloon.
It's very much not nuanced. The purpose is intimidation and a show of political and military strength. Missile attacks on apparently helpless watercraft serve that purpose quite nicely.
Wasting massive amounts of money with no intel and (especially) no reason is the public policy of the current administration. So it’s not that hard to believe it also extends to the Department of Defense.
I think they murdered an innocent man, Alejandro Carranza, a Colombian fisherman. The President of Colombia himself personally advocated on his behalf; it's been all over international news. Does this stuff not diffuse into your echo chamber?
> "On the same Saturday, Petro declared that U.S. officials “committed murder and violated sovereignty in territorial waters,” stating that the fisherman identified by RTVC as Alejandro Carranza had no connection to drug trafficking. In subsequent posts, the Colombian president has repeatedly emphasized that Carranza was a “humble fisherman.”"
I expect them to show some evidence -at the very least- to Congressional members of both parties, and I mean hard evidence. And also an analysis why this is better than just arresting them since they obviously aren't launching missiles back. They haven't even provided minimal evidence, and have been partisan in the sharing of it with only their preferred members of Congress, what little they've shown so far.
They are trying to distract from multiple crisis at home including the relationship of the president with a disgraced pedophile and alleged misdeeds.
I would expect them to provide the proof that served as justification for the strike and an explatation as to why a strike rather than interdiction was lawful and justifiable.
Eg an intelligence source suggested this very boat was being being used by Bob the blow on such and such a date Bob was responsible for ordering the murder of 4 FBI agents and due to assets available it would have been a huge risk to our people and it might be difficult or impossible to local bob any time in the near future.
If need be this justification may be given secretly to a bipartisan group of lawmakers who assert vague but important findings like we believe that the strikes are justified and didn't kill innocent people.
Same thing they are doing everywhere else they can, shitting their diapers and punching everyone in the nose with shit hands. They are pushing everything they can domestically and foreign to create a spark of war.
Shooting at all boats indiscriminately to induce a general feeling of fear partially so drug smugglers think twice and partially to provoke Venezuela who Trump politically disagrees with.
Sucks for the 60 odd random peoples’ families that died though.
I heard a fascinating interview with Sandeep Vaheesan[1]
He said in the early days of American electrification, private power companies wouldn't build lines to rural customers because it wasn't expected to be profitable. So rural customers joined together and formed public power companies and got the job done. Not only that, they innovated many cost saving technique which the private power companies eventually adopted.
Public power cooperatives still exist, but have themselves become ossified and commercialized over the years.
That's not what we're talking about. What we're talking about is: "We did your tax return for you based on all the information reported to us. Please click 'OK' to complete your return for the year."
> Calling it "tree shaking" is web development term AFAIK.
I think that's backwards. Lars Bak and the other V8 folks came from the Smalltalk world and brought the "tree shaking" term with them as far as I know.
In any case, before the JavaScript usage, it seems that treeshaking applied to objects to be included in a runtime image. The JavaScript usage is actually more akin to the dead-code elimination and link-time symbol removal of compiled and linked languages.
reply