News for hackers. Stuff that matters.
Re:Doo: A Simple, Fast Programming Language Built on Rust an... by Panzerschrek on Tuesday November 04, 2025 @12:57AM (#45807797)
When I say safety I mean inability of the programmer to trigger UB using normal language features, like it's impossible in Rust and several other (less known) languages. Does Doo support it? Or I just can shoot the leg and compiler lets me do this?

About references: am I correct, that any value is reference-counted and one can pass it to a function and mutate it (the original, not a copy).

Re:Doo: A Simple, Fast Programming Language Built on Rust an... by nynrathod on Tuesday November 04, 2025 @01:33AM (#45807979)
Doolang aims for memory safety with static typing and automatic reference counting, so you won't see classic C/C++ bugs. But it does not claim Rust's level of safety there’s no formal guarantee that safe code can't cause undefined behavior. It's quite safe in practice, just not as strict as Rust.

For complex types (strings, arrays, maps), values are reference-counted and passed by reference. If you pass such a value to a function, you're sharing the same object—mutations affect the original. For primitives (Int, Bool), it's pass-by-value (copy).

Re:Doo: A Simple, Fast Programming Language Built on Rust an... by Panzerschrek on Tuesday November 04, 2025 @02:16AM (#45808237)
So, what if I want to pass a value of a primitive type by-reference? How the equivalent code for the following C++ example looks like?

  void Foo( int& x )
  {
      x= 123;
  }
  
  void Bar()
  {
      int x= 0;
      Foo(x);
  }
Re:Doo: A Simple, Fast Programming Language Built on Rust an... by nynrathod on Tuesday November 04, 2025 @02:41AM (#45808405)
Doolang currently does not allow you to mutate a primitive variable from another function.

Only support this as of now

fn Foo(x: Int) { x = 123; // Only modifies Foo's local copy print("inside Foo", x); // Print 123 } fn main() { let x: Int = 0; Foo(x); // x is still 0 here after Foo returns print("out x", x); // Print 0 }

Re:Doo: A Simple, Fast Programming Language Built on Rust an... by nynrathod on Tuesday November 04, 2025 @01:34AM (#45807984)
But your points make sense, i should learn those UB works and will check how its behaving