8 ms·
> The ability to make number types that were limited in their range is really useful for certain classes of bugs. Yes! I would kill to get Ada's number range f
by Veliladon 1y ago
> The ability to make number types that were limited in their range is really useful for certain classes of bugs.
Yes! I would kill to get Ada's number range feature in Rust!
- pjmlp 1y agoThat feature is actually from Pascal, and Modula-2, before making its way into Ada. For some strange reason people always relate to Ada for it.
- Veliladon 1y agoFor me it's because I learned Ada in college. 18 year old me couldn't appreciate how beautiful a language it is but in my 40s I finally do.
- awesome_dude 1y ago2000-2005 College was teaching Ada? 2005-2010 my college most interesting (in this direction) language was Haskell. I don't think that there was any other language (like Ada) being taught)
- rus20376 1y agoAda is sometimes taught as part of a survey course in Programming Languages. That’s how I learned a bit about it.
- firesteelrain 1y agoYes, I learned it in a course that surveyed a bunch of different languages like Ada, Standard ML, and Assembly
- jdrek1 1y agoI would guess that Ada is simply more known. Keep in mind that tech exploded in the past ~3.5 decades whereas those languages are much older and lost the popularity contest. If you ask most people about older languages, the replies other than the obvious C and (kind of wrong but well) C++ are getting thin really quickly. COBOL, Ada, Fortran, and Lisp are probably what people are aware of the most, but other than that?
- wpollock 1y agoYou've forgotten about BASIC, SNOBOL, APL, Forth, and PL/1. There were many interesting programming languages back then. Good times!
- aworks 1y agoThe first five languages I learned back in the 70s: FORTRAN, Pascal, PL/I, SNOBOL, APL. Then I was an Ada and Icon programmer in the 80s. In the 90s, it was C/C++ and I just never had the enthusiasm for it.
- prerok 1y agoI found Pascal more readable as a budding programmer. Later on, C's ability to just get out of the way to program what I wanted trumped the Pascal's verbosity and opinionatedness. I admit that the terseness of the syntax of C can be off-putting. Still, it's just syntax, I am sorry you were disuaded by it.
- dreamcompiler 1y agoIcon (which came from SNOBOL) is one of the few programming languages I consider to embody truly new ideas. (Lisp, Forth, and Prolog are others that come to mind.) Icon is an amazing language and I wish it was better known.
- failingforward 1y agoYou probably know this but, for anyone else who is interested, the easiest way to get a feel for Icon nowadays may be through its descendant Unicon which is available at unicon.org.
- aworks 11mo agothanks for the reminder. will give it another try.
- 1y ago
- sehugg 1y agoTurbo Pascal could check ranges on assignment with the {$R+} directive, and Delphi could check arithmetic overflow with {$Q+}. Of course, nobody wanted to waste the cycles to turn those on :)
- pjmlp 1y agoMost Pascal compilers could do that actually. Yeah not wanting to waste cycles is how we ended up with the current system languages, while Electron gets used all over the place.
- prerok 1y agoI would argue that was one of the reasons why those languages lost. I distinctly remember arguments for functions working on array of 10. Oh, you want array of 12? Copy-paste the function to make it array of 12. What a load of BS. It took Pascal years to drop that constraint, but by then C had already won. I never ever wanted the compiler or runtime to check a subrange of ints. Ever. Overflow as program crash would be better, which I do find useful, but arbitrary ranges chosen by programmer? No thanks. To make matters worse, those are checked even by intermediate results. I realize this is opinioned only on my experience, so I would appreciate a counter example where it is a benefit (and yes, I worked on production code written in Pascal, French variant even, and migrating it to C was hilariously more readable and maintainable).
- pjmlp 1y agoThankfully instead of overflow, C gets you the freedom of UB based optimizations.
- prerok 1y agoFunny :) It still results in overflow and while you are right that it's UB by the standard, it's still pretty certain what will happen on a particular platform with a particular compiler :)
- ummonk 1y agoNo, optimizing compilers don't translate overflow to platform-specific behavior for signed integers - since it's UB they'll freely make arithmetic or logic assumptions that can result in behavior that can't really be humanly predicted without examining the generated machine code.
- uecker 1y agoThey are free to but not required. You can pick a different compiler, or you can configure your compiler to something else, if it provides such options. I always found it surprising that people did not reject clang for aggressively optimizing based on UB, but instead complained about the language while still using clang with -O3.
- nicce 1y agoThere is RFC but I guess the work stopped.
- weinzierl 1y agoIt is worked on under the term "pattern types" mainly by Oli oli-obk Scherer I think, who has an Ada background. Can't tell you what the current state is but this should give you the keywords to find out. Also, here is a talk Oli gave in the Ada track at FOSDEM this year: https://hachyderm.io/@oli/113970047617836816 https://hachyderm.io/@oli/113970047617836816
- afdbcreid 1y agoAFAIK the current status is that it's internal to std (used to implement `NonNull` and friends) and not planned to be exposed. There were some talks about general pattern type, but it's not even approved as an experiment, not to talk about RFC or stabilization.