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


I meant the C++ definition of collatz that would verify the precondition.

I haven't tried it and am afk rn but I'd imagine you just define a constexpr function that implements collatz and use that in your contract.

(Edit: if the input is constexpr itself) Its also quire easy to think about specializing a few templates and doing it that way. If you look up an example of the fib sequence in c++ templates you'll get the general idea.


I feel like I'd have something to learn from seeing the code.

Won't you just run into a constexpr evaluation depth error with a suggestion to set -fconstexpr-depth? I don't see how this is the gotcha it's made out to be.


I'd exepct something like that to happen. Worth reiterating that the whole scenario is for a hypothetical different implementation of contract that would execute comptime, as noted in the parent thread.

If you wanted a c++26 preconditon for collatz tho, here it is. ```cpp bool collatz(unsigned long long n) { while (n != 1) n = n % 2 ? 3 * n + 1 : n / 2; return true; }

void f(unsigned long long n) pre(collatz(n)); ``` That's basically what you'd write if you were doing it with asserts, as the linked article states, just now you add it to the declaration.


You may have to internally use bignums since collatz orbits can become very large before shrinking.

That's a good point. I wonder how difficult comptime bignum would be in comptime. Seems like there's no proven bounds I could find either

https://en.cppreference.com/cpp/preprocessor/impl:

“ISO C language standard requires that C compilers support the following three pragmas, and some C++ compiler vendors support them, to varying degrees, in their C++ frontends:

  #pragma STDC FENV_ACCESS arg      (1)
  #pragma STDC FP_CONTRACT arg      (2)
  #pragma STDC CX_LIMITED_RANGE arg (3)
where arg is either ON, OFF, or DEFAULT.”

⇒ it seems C compilers must support this (but C++ compilers need not)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678

At least some GCC devs claimed that the standard does not impose any requirements on these macros if a compiler does not claim strict ISO/IEC 6055 (aka IEE 754) conformance (which is still optional, and gcc and clang do not claim it).

Other devs disagree.


I admit "We don't have to comply with the standard if we don't claim to comply with the standard" is tautologically true.

But it does kind of support the whole "GCC C is not standard C" point.


A C implementation can be fully-compliant without conforming to ISO/IEC 6055, that's optional; question is just whether that optionality extends to fenv.h too. (at least how far I looked, imo it doesn't, and the pragma must exist, and valid fesetround calls (which there may be none of if no FE_* rounding modes are defined) must be represented by FLT_ROUNDS, even if it changes literally no actual float op behavior)

Objectively, this isn’t much different from an app offering in-app purchases.

Subjectively, however it feels significantly different to me.

Reasons why that’s the case that I can think of are:

- it shows the offer even when users aren’t searching for the offered product?

- the product that is offered doesn’t signal “in-app purchase”?

- it doesn’t feel like Apple to do this in this way.


> Given a constanct C, you can construct a constant sequence f(n) = C.

> Since f(n) is trivially computable

That only is true if C is computable.


Integers are what's relevant to BB, and all integers are computable.

So what if we set C = BB(10)?

It's hard or maybe impossible to figure out what BB(10) is. But abstractly, it is some finite integer. That finite integer is trivially computable: make a turing machine that hardcodes all the digits and outputs them one by one. You can't know that this machine actually produces BB(10) if you don't know what BB(10) is, but that's separate from the question of whether the number itself is computable.

The integer C is computable. However, we do not know what integer C is without first computing BB(10); and doing that might be not be possible.

But BB(10) is also just an integer. So it should be computable?

There is some notational subtletly here. Strictly speaking, BB(n) represents the output of the BB function for the input n. In that sense BB(n) is computable.

However, the BB function itself is not computable. It makes sense to ask "for what inputs is the BB function computable?". When people talk about BB(n) not being computable, they are really talking about the computability of the BB function at n, not the computability of the integer that happens to be BB(n).


BB(10) is computable. That doesn’t mean anyone can actually figure out what it is. It doesn’t even mean it’s theoretically possible to do so. Computable just means that there exists a turing machine that will output the digits.

> The implemented Rust semantics are not sound, as evidenced by this issue. We need to find (or adjust) sound semantics.

You’re ignoring the possibility that Rust semantics are sound, and the implementation doesn’t fully implement them. In that case, we do not have to find sound semantics.

That, I think, by far is the most likely option.

Reason: I’ve not seen a single comment claiming the example should compile, and zillions (implicitly) acknowledging this is not what Rust should do.


I explicitly did not ignore the option that there are possible sound semantics:

> but not necessarily for this one specifically

> Maybe, maybe not.

But "the Rust semantics" are not defined, formally. The closest we have is what Rust implements currently, and that was shown here to not be sound. Other than that, we maybe have vague ideas in the brains of some T-types members, which are not detailed enough to determine soundness (source: those type system people want to formalize the semantics so they will be).

And for the record, we know of other soundness issues where the likely resolution path will involve rejecting valid programs we accept now, and the only question is how many.


"the Rust semantics" are defined informally as sound. Anything that the implementation accepts that is unsound is a bug. We might never be able to prove the rust implementation, and may forever find loop holes, but informally it is sound and that is the intent.

> The original was dialled-in to be small (obviously), dignified, reserved, charming, practical.

I disagree. It was designed to be affordable (both in sales price and in maintenance) and practical. It only was small because that was needed to meet those goals. Reserved as in “no frills” also comes from “affordable”.

Dignified I don’t think it ever was. What do you think made it that?


>Dignified I don’t think it ever was. What do you think made it that?

it was a car designed to get rural farmers to stop riding horses everywhere.

it's slightly more dignified when your mode of transportation doesn't take a literal shit in the street.


> it would look something like a = round(fma(a, b, c))

One problem with that is that it makes it look as if the language is more expressive than it is. You might not be able to write, for example

  d = round(fma(a, b, c))
because the instruction doing that is a three-register one.

Another example, on x64 (IIRC)

  a = a + b + 42
  d = d + 4 × e
  d = 5 × d       // equivalent to d = d + 4 × d
would be valid (being LEA variants), but

  a = a + b + c
  d = d + 5 × e
  d = 7 × d
would not. So, this would be more readable, but I’m not sure it would be easier to write.

You can make it easier to write by allowing ‘obvious’ rewrites such as

  a = b + c + d
into

  a = b + c
  a = a + d
but then, you’re on your way towards a generic programming language, and where do you stop?

It also soon doesn’t get obvious, as it might be possible to avoid the data dependency in the rewrite or to do another ‘obvious’ thing, and move the instruction following that a = a + d up between the two instructions.


I don't allow such rewrites, you have to be explicit. If you write something that doesn't have a valid assembler encoding, its rejected at compile time.

It helps that I'm currently targeting ARM (Cortex M33, RP2350 specifically). Old-school x86 would be much less pleasant, as it's got so many arbitrary-seeming rules of what works and what doesn't. One quirk, when optimizing for file size, are the rules for which instructions have 16 bit encodings and which need 32. But again, the plan is to have a tight feedback loop.


I think there will never be mass-market “Linux phones” in the sense of “runs a Linux kernel and you can tinker with all their parts”.

Demand simply is too low. FTA: (https://amosbbatto.wordpress.com/2026/10/05/linux-phones-alt...):

“Jolla has sold 15,000 units of its phone as of August 2026 just by taking pre-orders for production batches from its web site”

In comparison, Apple easily sells 15,000 phones each hour of the year.

So, the best hope for such a Linux phone would be to have something installable on hardware of a third party that normally ships Android. I don’t see that happen because such hardware gets locked down more and more to defend against cybercrime.


I don't think it is fair comparing Jolla agains half of the current Smartphone monopolists.

Also you need to build an ecosystem so that users and developers can get involved & open hardware fully supported by Sailfish OS is a good start.

Also a lot of mainstream mobile hardware is locked down on purpose to effectively enforce planned obsolescence, which makes it harder to port a sane OS on it.


It’s interesting to see how they got there. https://en.wikipedia.org/wiki/HarmonyOS:

“From 2019 to 2024, versions 1 to 4.3 (4.5 TV) of the operating system were built by integrating the Android Open Source Project (AOSP) with OpenHarmony, allowing it to support both HarmonyOS and Android apps. The current iteration of HarmonyOS became known as HarmonyOS NEXT (later it was renamed HarmonyOS 5 in launched of Pura X). HarmonyOS NEXT was announced on August 4, 2023, and officially launched on October 22, 2024. It also replaced the OpenHarmony multi-kernel system with its own HongMeng Kernel at its core and removed all Android code. Since version 5, HarmonyOS only supports apps in its native "App" format.

HarmonyOS 5.x+ both discards the common Unix-like Linux kernel and replaces the previous multiple-kernel, kernel agnostic system from OpenHarmony with its own bespoke HarmonyOS microkernel as a single framework.”

⇒ this shows it’s possible to create a new stack. It’s not Linux, though, and I think a large reason for this succeeding is that it started in the Chinese market after the US sanctioned Huawei.


> this shows it’s possible to create a new stack. It’s not Linux, though, and I think a large reason for this succeeding is that it started in the Chinese market after the US sanctioned Huawei.

Even so, I think it's helpful in that it weakens the duopoly. If app builders are getting used to building apps for other platforms than Android/iOS, it hopefully also becomes easier for others to gain some foothold.

Especially given the heavy commissions and other developer-hostile behaviour of these two. They've been essentially treating devs like shit and IMO a reckoning has been coming for a while now. Of course, you do have to meet the users where they are, at least up to a point.


Further fragmenting the user base into a third closed ecosystem is good because app builders have to build 3 versions so...now they'll be more willing to build a fourth version?

That logic doesn't follow. This is bad in all meaningful ways for open source.


Or, perhaps, developers would not require you to use an app when a website would perfectly suffice.

...by being even less open than Android. It's not an improvement

And it also has new programming languages ArkTS (Typescript inspired) and now in the process of having Canjie, as their own "Swift".

> HongMeng Kernel

Wait do they mean this Hong Meng?

https://en.wikipedia.org/wiki/Hong_Meng

If so, this is one of the funniest parts of Zhuangzhi.


One reason is that there is no such thing as the compiler. C ‘always’ had many different implementations.

Requiring all of them to adopt common linting rules at the same time is infeasible.

Also, it’s not true that linting rules never become part of the compiler. For example, the original lint (https://wolfram.schneider.org/bsd/7thEdManVol2/lint/lint.pdf) states

“The type-checking rules also require that, in structure references, the left operand of the -> be a pointer to structure”

and mentions warnings on such statements as

  int i 1;
  i =- 1;
Modern C compilers also warn way more often about unreachable code, pointer incompatibilities, etc. than those from the 1970s

Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: