2 ms·
Yeah, I do find the compiler errors useful, I just wish I did not have to see them to understand the code. I am not really trying to "trashtalk" Rust or anythin
by johnisgood 6y ago
Yeah, I do find the compiler errors useful, I just wish I did not have to see them to understand the code. I am not really trying to "trashtalk" Rust or anything, I just "keep on" expressing my opinion on my dislike of heavy use of symbols. That is all. :) I have written plenty of Perl code, too, and I was even proud of myself! Problem is that after a few weeks I could not tell what particular bits of code did. :D
"There comes a time when words are more appropriate than symbols."
- steveklabnik 6y agoI have a camel tattoo. I don’t find a Rust to look anything like Perl. YMMV :) I find Ada very hard to read. ... come to think of it, doesn’t it also have unbalanced apostrophes? It’s been a while.
- johnisgood 6y agoYeah, it does have its differences, that is true. > unbalanced apostrophes? What are you referring to exactly? Can you give me an example? Do you mean something like Integer'Last, which is the largest value of type Integer?
- steveklabnik 6y agoYes! This syntax is in the first example on https://learn.adacore.com/ https://learn.adacore.com/.
- johnisgood 6y agoAs for the above example: they are called attributes. Here is a list of attributes: https://en.wikibooks.org/wiki/Ada_Programming/Attributes https://en.wikibooks.org/wiki/Ada_Programming/Attributes > The concept of attributes is pretty unique to Ada. Attributes allow you to get - and sometimes set - information about objects or other language entities such as types. A good example is the Size attribute. It describes the size of an object or a type in bits: type Byte is range -128 .. 127; -- The range fits into 8 bits but the compiler is still free to choose. for Byte'Size use 8; -- Forces the compiler to use 8 bits. I find it particularly neat. Of course one of the best things I love about Ada is pre- and post-conditions or contract-based programming (that are actually checked, unless in languages like Kotlin that just bolted on some contracts that are just there for the reader, i.e. pretty useless, to be honest). Ranged types are awesome, too, as you tell the compiler the range you want and the compiler chooses an appropriate sized integer to suit the range, which is the important bit. For example, instead of asking for "16-bit signed integer", you say: "I want a type which can store values between -1 and 1000", and maybe even a hint for the compiler where you can ask the compiler to pick you a faster type or a smaller type, so you say: type Index is range -1 .. 1000; Types like these are much more readable, and you can use attributes on them such as 'Min, 'Max, 'Range, and so forth. It is such a good feature, and you can remove the range checks if you want, and you can even have them checked at compile-time. These kind of features are what I would like to see from a C replacement. See more at https://learn.adacore.com/courses/intro-to-ada/chapters/strongly_typed_language.html https://learn.adacore.com/courses/intro-to-ada/chapters/stro.... --- https://www.adaic.org/learn/materials/intro/part1/ https://www.adaic.org/learn/materials/intro/part1/ https://www.adaic.org/resources/add_content/docs/craft/html/ch01.htm https://www.adaic.org/resources/add_content/docs/craft/html/... https://www.adaic.org/advantages/features-benefits/ https://www.adaic.org/advantages/features-benefits/ https://www.radford.edu/nokie/classes/320/designGoals.html https://www.radford.edu/nokie/classes/320/designGoals.html https://hackaday.com/2019/09/10/why-ada-is-the-language-you-want-to-be-programming-your-systems-with/ https://hackaday.com/2019/09/10/why-ada-is-the-language-you-... Those links might give you some idea about the language and its goals, if you really are interested. Of course there are much more, up-to-date sources, but I think these got most of it right.
- steveklabnik 6y agoThanks. I went through all of the learn.adacore.com stuff, but it was like 18 months ago.
- johnisgood 6y agoYou know what? You might be even able to implement this in Rust! index = num(-1->1000); or something. :D I dunno how attributes would work, but man, they really are handy. It is very, very difficult to shoot yourself in the foot.
- steveklabnik 6y agoRust's "associated constants" are a very similar feature. You can also do runtime checked ranged integer types, and compile-time checked ones, though that's very awkward at the moment. It'll get un-awkward at some point; an implementation of the feature needed is in nightly.
- 205guy 6y ago> have unbalanced apostrophes? It’s been a while. I see what you did there (but maybe you don't see it yourself :-) PS: at least MY parentheses are balanced.