Hacker News new | ask | show | jobs
by honestlyidk 2790 days ago
All those are is a set of verification functions tied to strings ... we really dont need native data types representing this. Im not sure why you are not able to find a lib/function that easily verifies such things. Programing languges are the basic foundation which should be concerned with performance , organization and making sure freedom is given to the programmer. These are all specific edge cases for the programmer to define not for the programing language to worry about.

Would you rather they speed up the compiler/interperter or add edge case string classes? Its not like there isnt a trade off. This is a bottom of the barrel concern.

2 comments

> Programing languges are the basic foundation which should be concerned with performance , organization and making sure freedom is given to the programmer.

This is one view, but there are others. For example, instead of focusing on performance and freedom, the programming language could focus on safety or formal properties.

E.g. there should never be code that compiles but is unsafe, or which can have certain classes of common bugs.

That’s a valid view, but it would definitely be powerful if the language’s type system could express restricted character sets, right? You can already do something like this with e.g. Ada’s constrained subtypes, like encoding the length of a string or the range of a number into the type, making it statically impossible to accept invalid input. That’s really cool!