3 ms·
The last thing you want is types when you're a beginner. TCL/Shellscript, for all its defects, just has strings, which means you have expr num OPERATOR num. you
by nmz 3y ago
The last thing you want is types when you're a beginner. TCL/Shellscript, for all its defects, just has strings, which means you have expr num OPERATOR num. you also just have commands. I've seen beginners try to set a variable from whatever is printed, so the concept of a return type is a tricky one. funny, now that I think about it, php is actually a great introductory language because it just prints everything to stdout.
- trealira 3y ago> The last thing you want is types when you're a beginner. I disagree. Data types are an intuitive concept. Integers and strings are obviously different, and you can do further and distinguish arrays, characters, and dictionaries. I'd argue Python is slightly beginner unfriendly in this one way because variable types are implicit rather than explicit (unless you use type annotations), but still important, as you'll get a type error if you try to, for example, sum a number and a string.
- nmz 3y agoPerhaps its because I learned programming via shellscript(rc not bash) and piping text into programs. I never had to deal with the difference between a string and a number unless I did something that actually needed the difference to be distinguishable. especially dealing with awk which just coerces greatly, hell, I didn't even have to deal with size limits since pure awk supports bignums. Sure, awk has types as well, but that concept came much later, especially things like scope. I think it both helped me and hurt me. I never understood why people said static typing was great, only after you had a huge program did you see where the pitfalls were.
- trealira 3y agoThat's an interesting perspective. It probably does have a lot to do with the first programming languages you learn. The first programming languages I learned were all strongly typed, so it seemed inherent to the concept of a variable when I learned it. I had to wrap my head around dynamically typed languages as "Ah, all variables are actually just pointers to structures with a tag indicating the type, and they can be rebound to objects with different types." When I write Python, I use type annotations, or I keep track of the type in my head, and use casts as convenient conversion functions. But, since Awk and shell script don't make you cast things explicitly as much as Python, I can also see how someone would learn programming with dynamic types in a really natural way.