News for hackers. Stuff that matters.
Re:GUIDs Are Not the Only Answer by winrid on Tuesday January 05, 2021 @06:39PM (#25652849)
This is one thing I like about type systems where you can declare a primitive type as MyImportantThing. This ensures the string or what have you is explicitly defined as MyImportantThing. Rust does this pretty well. C/C++ AFAIK will let you pass in the raw string, and so will Java if you "extend String".
Re:GUIDs Are Not the Only Answer by remexre on Wednesday January 06, 2021 @08:27PM (#25665994)
You're talking about what is called the newtype pattern in Rust, and the newtype language feature in e.g. Haskell, right?
Re:GUIDs Are Not the Only Answer by yrimaxi on Tuesday January 05, 2021 @06:56PM (#25653027)
What does it mean to “extend String” in Java? You can’t, of course, literally do that.
Re:GUIDs Are Not the Only Answer by winrid on Wednesday January 06, 2021 @12:47AM (#25654964)
Sorry bad example. Forgot it's final. :)