4 ms·
Sure, but if your objective is systems programming, you'll probably quickly get to the point of realising python is not the right choice.
by hgomersall 4y ago
Sure, but if your objective is systems programming, you'll probably quickly get to the point of realising python is not the right choice.
- pjmlp 4y agoDepends, if writing a compiler is still considered systems programming in modern times. https://www.amazon.com/Writing-Interpreters-Compilers-Raspberry-Python/dp/1977509207 https://www.amazon.com/Writing-Interpreters-Compilers-Raspbe...
- less_less 4y agoCompilers are their own beast — I wouldn't put them with systems code. They're pretty different from an OS, BLAS, machine learning kernel, game engine, network stack, database or what have you. There's not as much buffer management, speed and memory aren't usually as critical, you don't make direct syscalls, many structures are graphs rather than arrays, etc. They often aren't even multithreaded. It's also popular to write compilers in distinctly non-"systems-y" languages, most notably Standard ML but also eg Haskell, and lots of languages are self-hosted.
- travisgriggs 4y agoI think compilers are a strong sub field of meta programming. I see meta programming as anything that deals directly or indirectly with ASTs. Compilers (er parsers and linkers) make ASTs and transform them. Refactoring engines (should) work with them. Sadly, I’m not sure what language I’d recommend as ideal for this (meta programming) now days. I think it’s zen cool when a language like Lisp or Zig or Elixir slides sideways in and out of meta programming, but that doesn’t mean they have good ASTs to work with, or that they’re ideal as a pseudo language to manipulate them. It should be something that is both not too complex, but also not so zen abstract that you have to bootstrap meaningful things endlessly. I personally liked the Smalltalk AST. But I couldn’t speak to its pedagogical or industry value as a meta programming environment.
- eru 4y agoAre you talking about the tools that eg Lisp has to manipulate arbitrary ASTs, or are you talking about the AST required to represent Lisp code? Racket (a Lisp) and ML-family languages like Haskell are really good at manipulating arbitrary ASTs and similar structures. ML was even invented to do exactly that, the letters stand for meta-language. I do agree that the structures you need to represent Haskell would be rather complicated: Haskell is a rather complex language after all. I'm not sure what you mean by having to bootstrap meaningful things endlessly? I can understand that eg C is pretty limited, so you have to put in lots of effort to bootstrap to something meaningfully. But most higher level languages would be doing just fine. And you can also use libraries: Eg no need to write your own parser from scratch, if you can just use a parser combinator library like parsec. Also no need for a beginner to write native code generation from scratch: just use a library to interface with llvm.
- eru 4y agoYes, compilers at most have a bit of overlap with systems programming, but don't really have that much to do with it. The overlap comes from two places: (1) If you want to generate fast code, you need to know how your target works. That's pretty low level, and could be considered systems programming? (2) Many people want compilers themselves to run fast. Here again, the way to get the most speed out of your programs is often to go low level (and again we could see low level as a synonym for systems programming?)
- pjmlp 4y agoAt which level would you place the OS linker required by the compiler? Given that Bastion written in XNA, and widely successful, then from your list C# is a system programming language. Or maybe Java is one, given Minesweeper and bare metal deployments like those sold by PTC and Aicas.
- amelius 4y ago> Compilers are their own beast — I wouldn't put them with systems code. Unless your systems code runs using a JIT.
- nicoburns 4y agoIf your objective is specifically systems programming then you'll quickly outgrow python, but I'm not convinced that makes it the wrong starting point. For systems programming you'll likely need both high-level and low-level programming concepts. Learning low-level first is absolutely a valid path, but my point is that going high-level first is equally valid. People on the internet like to make out like someone who starts out by learning Python are incapable of later learning low-level concepts, but if anything they're at an advantage compared with someone with no programming experience at all.
- zarzavat 4y agoIt’s easier to learn low level first because then you are going “downhill” as you move into higher level languages. For a Python programmer, the borrow checker is terrifying and confounding “Why do I have to do this lifetime nonsense just to make a string? I don’t have to do that Python!” For a C programmer, the Rust borrow checker is likely to elicit feelings of relief and jubilation “You mean I don’t have to spend another afternoon in valgrind tracking down use after free bugs? Awesome!”
- eru 4y agoI started with BASIC on a C64. BASIC was always supposed to damage your brain. So far, C, Scheme, Python, Haskell, Erlang, Rust etc haven't been too hard. (Though I'm not sure I'm cut out for C++'s antics or Java's dependency injection.)
- nicoburns 4y agoMy experience hanging out in r/rust for the last few years is that it’s C, C++, and Java programmers who have the most trouble with the borrow checker. Many C/C++ programmers are used to being able to play fast and loose with pointers, and find the borrow checker restrictive because it won’t let them use the patterns they’re used to using. Java programmers are used to an object oriented style with mutable references to objects all over the place (which you can’t do in Rust). OTOH hand languages like python (and especially JavaScript where pipelines of pure data transformations are already idiomatic) don’t use references much anyway, so use of them is new and doesn’t come with so many expectations.
- nvrspyx 4y agoThis is just my opinion, but I can't imagine systems programming being the objective of any beginner. A beginner probably wouldn't even be able to differentiate systems programming from applications programming.
- eru 4y agoDepends. I can totally imagine someone who has no clue about programming, but is fascinated by what the demoscene people do with a Super Nintendo. Extremely low level programming would be their motivating goal, even if they don't know it yet.
- blub 4y agoThe domain drives programming language choice, so if they’re fascinated by the demoscene they’d look into C or assembly, I imagine. On the other hand, if they’re fascinated about cryptocurrencies, Rust would be a logical choice.
- benj111 4y agoI can't speak for others but I started programming to understand how all the low level stuff works. I think there's merit in learning assembler because you then appreciate what all the other languages are doing under the hood, but then python is also good for getting something done quickly. I suppose it's what scratches you itch. If you want to print out "hello world" quickly and easily then python is a better bet. If you want to know the mechanics, assembler is the better bet.
- jollybean 4y agoWhen we teach software were starting with 'functions' 'variables' and 'algorithms' not specific kinds of programming.
- hgomersall 4y agoAnd ownership, types, generics and concurrency... Essentially, we're teaching some aspects of computer science. The more you can express, arguably the more you can learn. I certainly learned a huge amount when learning rust. It would have been valuable to me to know that 15 years ago.
- jollybean 4y agoI'd argue that ownership and even generics are not really fundamental to computer science.