Recent

Author Topic: Return nil/null of data type  (Read 1657 times)

Warfley

  • Hero Member
  • *****
  • Posts: 1864
Re: Return nil/null of data type
« Reply #15 on: January 24, 2025, 12:51:48 pm »
Different concepts need to be explored. But not all of them work in practice (at least for now). And not all of them are suitable for implementation in a programming language (especially imperative).
Yeah but we are talking about maybe types, which together with union types, are are the main error handling mechanism in go, rust, are baked into the language for swift, kotlin. Nullable types have been also introduced in and are very commonly used in C#, Java, C++.

What do you mean mit doesn't work in practice? These concepts are used everyhwere. Rust alone is used in the Linux kernel, windows OS, Firefox and so much more, and Optional types are the main error handling mechanism there.
It works in practice, it is used in practice and in fact it is currently replacing many of the other pracitices as we speak.

Yes, functional languages are "trendy" and they are "great" (on paper, on screen, when you read it on a blog). They have everything, they do everything (and even more). Only that... this fashion came and went. Now it's probably the 4th wave.
I mean first it's not just on blog posts, but also in practice. When Ericsson rewrote their router software in Erlang, a functional language, from previously C++, an OOP language, they observed a 4-10 times increase in productivity, reduction in bugs and code size (source).
Besides this, the whole whatsapp infrastructure is written in erlang, facebook uses Haskell for their data analysis tools. Real functional languages may not be that popular in themselves, but they aren't just research also, they are powering some of the biggest software on the planet.

And these are just real functional languages, what is more is functional influence, to take Rust again, it has take a lot of concepts from functional languages, infact I would even argue that it is equal parts functional and procedural. While not to this extend other languages also borrow lots of concepts from functional languages, lambdas and closures are of course the most common ones, but algebraic typesystems, templates and generics or type inference are everywhere, even in Pascal. And they all stem from functional languages, and even more fundamentally are rooted in type theory and lambda calculus.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5858
  • Compiler Developer
Re: Return nil/null of data type
« Reply #16 on: January 26, 2025, 04:00:22 pm »
Quote
There is nullable in the RTL, the following uses new functions from trunk which will probably be in 3.2.4

Does this mean that we will be able to define types nullable, like following? 

   var
         ni : specialize TNullable<integer>;


Yes. Though it requires the use of the Nullable unit because that's where the generic type is declared.

 

TinyPortal © 2005-2018