HN user

anextio

414 karma
Posts0
Comments111
View on HN
No posts found.

Runtime binding only occurs for Objective-C interop.

Swift functions are bound at compile time when statically known. Dynamic dispatch is done through vtables for native Swift classes, and through witness tables for protocol existentials.

"Democracy" is when "bad actors" (as defined by the establishment) are shut out of all online discourse.

The point of ID laws is not to stop "bots" or "sockpuppets", it's to enable governments to shut down the speech of their political adversaries by painting them as dangerous. That is not democracy, that is authoritarianism, even if you absolutely hate the people that are being shut up.

Western countries are not in the midst of polarized political crises because of "external bad actors" or "sockpuppets". They're in these crises because of fundamental contradictions in values and desired policies between different segments of the populace.

The Europeans are currently full steam ahead in attempting to "fix" the situation by criminalizing dissent, which will, in the end, only exacerbate the political crisis by making the democratic system illegitimate.

Why Objective-C 5 months ago

[1] https://github.com/swiftlang/swift-evolution/blob/main/propo... -- apologies to the authors, but even as a previous C++ guy, my brain twisted at that. Inside Swift is a slim language waiting to get out... and that slim language is just a safer Objective C.

These kinds of features are not intended for use in daily application development. They're systems-language features designed for building high performance, safe, very-low-level code. It will be entirely optional for the average Swift developer to learn how to use these features, just in the same way that it's optional for someone to learn Rust.

Malicious compliance?

The EU DMA says they have to allow third party browser engines access to the same resources (the JIT) that Safari has. It specifically allows them to place reasonable requirements on those third party alternatives:

The gatekeeper shall not be prevented from taking, to the extent that they are strictly necessary and proportionate, measures to ensure that third-party software applications or software application stores do not endanger the integrity of the hardware or operating system provided by the gatekeeper, provided that such measures are duly justified by the gatekeeper.

Access to rwx memory is inherently dangerous, and it's completely reasonable to expect third parties to have proven that they are serious about producing a usable browser engine before putting such a risky product on the market for consumers to download. The law does not require them to allow any third party application to access the JIT, only a third party application that competes with Safari (a usable web browser).

Replying to your other comment.

You are claiming that static code analysis tools extensively used in C++ cannot detect all conceivable and hypothetical memory issues. The weasel words in here is that it is possible to detect them, but some can conceivably slip through.

No, there are entire classes of memory vulnerabilities that are impossible to check with static analysis because checking them is equivalent to the halting problem.

To drive the point home, there are already a few CVEs even from use-after-free bugs in Rust code. What does that make out of the all assertion? Would this be a reasonable argument to reject Rust as an unsafe language?

The CVE that you referenced in the other comment was Rust calling into unsafe C code, as I pointed out. If you have a real example feel free to post it.

The problem with these claims is that they rely on weak strawmen arguments and a very superficial analysis of the problem space. I get the need to do marketing, but if the audience is technical them don't you think arguments should stand on solid technical ground?

The views I have laid out here are the consensus among compiler engineers and in theoretical computer science. You only have to look at the compiler group at Apple:

- heavily invested in static analysis - maintains the clang static analyzer - maintains number of runtime memory analysis tools in Xcode - not invested in rust at all and seemingly not interested

Yet they are adding lifetime dependency annotations to Swift, making it more like Rust: https://github.com/swiftlang/swift-evolution/blob/ef71df4158...

The reason for this is that static analysis simply cannot do it when the semantic information about lifetimes is lost, even for a group that knows how to write strong static analysis tools. Program flow is too ambiguous without it, so it becomes impossible to detect such memory vulnerabilities without running the program and fuzzing it – an expensive, time consuming, and probabilistic process.

This is not a very good example, because this Rust code is a thin wrapper around pthread_mutex, which is an unsafe API that can cause undefined behavior (such as use after free) if used incorrectly. The Rust code in question is using the unsafe C API incorrectly.

https://github.com/Forestryks/process-sync-rs/issues/3

One could say "Rust doesn't stop you from calling out into unsafe C code, so it's still possible to produce memory vulnerabilities in Rust", and it would be true, but it kind of misses the point and only really bolsters the Rust people when they say they want to rewrite everything in Rust.

In Rust, an API with a rule such as "you must check that the mutex is unlocked before you can destroy it" would be implemented using the type system in such a way as to make it impossible to drop it without checking its state. This is something that is not possible to do in C and cumbersome to do in C++.

mainstream compilers provide support to detect and throw warnings/errors for some of these issues

You cannot detect all of these issues with static analysis. Rust does it by requiring the programmer to annotate lifetime dependencies in the source code. Without this additional semantic information, static analysis cannot fully reason about the lifetimes of variables.

There are efforts by some to introduce lifetime annotations to C++ (https://news.ycombinator.com/item?id=30888172), but any changes to the core language face a very steep uphill battle with the C++ standards committee, so any movement on this is likely to be compiler-specific attribute-based systems, adopted largely by companies invested in a particular compiler ecosystem (such as Apple or Google) to annotate their proprietary code.

On top of this, Rust is a very expressive language, with its features (like enum sum-types, traits etc) making it very easy to implement patterns such as compiler-checked state machines and polymorphism that doesn't involve the recognized downsides of class hierarchies.

It is not for everyone, and not for every kind of project, but its features resonate positively with a lot of people in systems programming because of their experiences with other systems languages and their downsides.

This is why Rust is popular today, particularly in certain communities.

Comments like this are the clearest sign that this topic has become so politicized that rational judgement is out the window. If fluoride in the water is opposed by *those people*, or is supported by *those people*, then even if new clear evidence comes out one way or another, it will be undermined by not wanting to hand the other side a ‘W’.

I'm not sure why you would think they are climate deniers. The odds are that they are exactly the opposite.

Having been around far left activist groups in my past, there are many who think that doing things like this on purpose is morally justified, because it keeps the conversation on climate change. The media incentivizes it by covering them as "climate-fueled wildfire" stories, every single time.

Wildfires in Canada were at a two-decade low in 2020, during the lockdowns. Think about that.

https://meduza.io/amp/en/news/2023/02/17/close-to-15k-russia...

An investigation via open sources by the BBC and Meduza (an anti-Putin media outlet based in Latvia) has confirmed the deaths of about 15k Russian soldiers since the start of the war, and estimates the true number to be up to 60% higher.

What sources do you have that the widely reported media number of 200k+ is actually true that doesn’t ultimately come from the government of Ukraine (who would have an interest in over-inflating their victories) or by a western government that is militarily supporting Ukraine?

They don't have to occupy the whole of Ukraine to do that, they only have to defeat Ukraine's military and destroy NATO's materiel on the battlefield. If they intended to occupy the entire country they would need several million troops as well as legions of administrators ready to go, which would be visible.

They most likely only plan to long-term occupy the parts of Ukraine where the majority of the population still living there supports them. The last thing that Russia wants is fighting a never ending insurgency in Lviv oblast.

The Russians have shown that they don't care about holding territory in the short term, see Kherson withdrawal, etc. They are only focused on attrition and minimizing their own casualties. If Ukraine goes into Transnistria it will not force Russia to capitulate.

How the laptop was "obtained" is actually a separate story from the content of the laptop, if the content is real.

Given that the content HAS been verified as real, then bringing up the circumstances of how the laptop ended up in the NY Post's hands is simply an irrelevant diversion designed to muddy the waters.

That word is doing a _lot_ of work there.

What work is it doing? If the content is real, what circumstances of the obtaining could possibly change opinions or analysis made *solely about* the content?

Nobody denies there were political machinations and obfuscations about the laptop's journey, involving political adversaries of Joe Biden, but that story is a separate one from analysis of the laptop's contents.

This is wrong and a total mischaracterization. It *was* an opinion piece that they blocked:

From Greenwald's resignation blog post [1]:

The latest and perhaps most egregious example is an *opinion column* I wrote this week which, five days before the presidential election, is critical of Joe Biden, the candidate who happens to be vigorously supported by all of the Intercept editors in New York who are imposing the censorship and refusing to publish the article unless I agree to remove all of the sections critical of the candidate they want to win.

Additionally, the emails he published between himself and the editors indicates specifically the claims they wanted him to remove, which did not include any factually inaccurate claims [2]:

But your memo *doesn't identify a single factual inaccuracy*, let alone multiple ones. And that's why you don't and can't identify any such false claims. And that, in turn, is why your email repeatedly says that what makes the draft false is that it omits facts which -- as I just demonstrated -- the draft explicitly includes.

[1] https://greenwald.substack.com/p/my-resignation-from-the-int...

[2] https://greenwald.substack.com/p/emails-with-intercept-edito...

callAsFunction() isn't really intended to be used in a type like Dice there. It's a bad example.

It's for Swift for TensorFlow's integration with Python, in which a bridged Python object can be called as a function. Functions are, of course, objects in Python, so that makes sense, but it would be a pain to have to call fn.call(bar) instead of fn(bar) when fn is a reference to a python object that is a function in its runtime.

It's also used in TensorFlow models, in which callAsFunction() is usually implemented as passing the model's input through all the defined layers in it.

This makes it easy to treat models as if they were functions, which they mathematically are, unlike Dice.

Example:

    struct MLP: Layer {
        var layer1 = Dense<Float>(inputSize: 2, outputSize: 10, activation: relu)
        var layer2 = Dense<Float>(inputSize: 10, outputSize: 1, activation: relu)
    
        @differentiable
        func callAsFunction(_ input: Tensor<Float>) -> Tensor<Float> {
            let h0 = layer1(input).withDerivative { print("∂L/∂layer1 =", $0) }
            return layer2(h0)
        }
    }

(from: https://www.tensorflow.org/swift/tutorials/custom_differenti... )
Broken 7 years ago

While I sympathize with your political position on free software, I have come to the unfortunate conclusion that this point of view is idealistic[1] and short sighted.

The vast majority of engineers don’t commit to switching to free software not because not enough hearts and minds have been convinced yet but because the entire economy and the basis of everyone’s material existence depends on a system that is at this moment market-based.

The popularity of proprietary software stacks is ultimately structural, as are the problems and caveats of proprietary software. Engineers are, in the vast majority, dependent on selling their labor to the commercial employment market for their livelihood, in many cases an extreme amount of labor in a highly competitive environment.

It is absolutely great that many engineers dedicate free labor to contributing to free software, and it is completely unreasonable to expect that anything at all could make the vast majority do it. Not an unreasonable expectation of an individual, but of the structure.

[1] in the sense of philosophical idealism vs materialism

ARKit 9 years ago

Developers are to ARKit what merchants are to Apple Pay. Users wouldn't care about Apple Pay if merchants didn't take it as payment.

more potent than vaporizers

It's not the method, it's the toxicity of the chemical itself. As others have mentioned, regardless of the method of extraction, purification, or intake, this does not change the ridiculous amount that would have to be pumped into the blood in order to kill someone.

Cannabinoids do not affect the brain stem, the primitive part of the brain that controls respiration and the heart. Many other drug overdoses are affected through this avenue. Cannabis does not and cannot.

You would have to adulterate it with another drug, in which case, it is a different discussion.

Your characterization of a product successfully marketed to people as "corporate brainwashing" whenever you don't like someone pointing out that a thing is perpetuated by corporate profit motives is also disingenuous.

I think the commenter was being a bit of an ass too, but I think he still has a defensible point, and it's not the absurd point that you're making it out to be.

nor are we driven by some need to display this disinterest as some kind of marker of class rank or intellectual superiority.

Not to disagree with you, but I was under the impression that most research on social signaling has shown that it is not a conscious phenomenon.

You don't do X because you think it will signal Y. You just do X, whether because of unconscious social signals you have received or because the information that X might signal Y is contained in the genome rather than in the brain.

Can anyone clarify?