Can someone with cognitive science back me up on my gut feeling? Everyone has a hard time learning new skills and everyone uses search engines occasionally, but going to these lengths to cheat actually impair learning.
Unless you count learning how to use the cheat sheet as a valuable skill.
I never thought of cheatsheets as literally cheating, more like terse examples of tried and true patterns (in other words not cheating but preventing inventing the wheel over and over again).
Absolutely right! And I was feeling guilty while creating cheat.sh. That is why we have developed some countermeasures. If we manage to implement this, cheat.sh will have the most important feature of any real cheat sheet: it will help not really to cheat, but to learn too.
Thank you for this your comment. That is actually the comment that made me register here. This is a very very deep and important thought. Thank you
There is difference between learning skills and memorizing small details (which are irrelevant in bigger picture). Cheatsheets help with latter.
The stuff usually found on cheat sheets is “How do I reverse a list in Python?” and not some insanely advanced skill.
Usually the answer is something inefficient and misleading, when it should be “Mu! You do not.” - and even then it’s not a hard thing to learn.
Learning how to deal with your language’s and framework’s etc reference manuals, now that’s a worthwhile skill. A gift that keeps on giving.
But it could potentially also grow the cargo-cult culture of programming: those who don’t understand the language and don’t care, but copy and paste snippets together and bash on it until they reach some definition of success. The snippets are helpful reminders for those familiar with the deep details, but could be uninformative and relatively context-free crutches that only hobble newer programmers from understanding why that particular snippet needed to be different to be the right answer to their actual problem, in the context of the code they’re actually working on.
The snippets are helpful reminders for those familiar with the deep details
Yep.
Sometimes I use snippets for complex operations that I don’t really care about.
I think this is a great example. https://stackoverflow.com/questions/39799999/parsing-a-soap-message-using-xpath-in-java
Let it suffice to say that I need that for some reason, and it’s not performance critical, and I fully understand that I’m going to get really deep call stacks and great gooey gobs of complex objects in memory during runtime. I can picture some approximation of it in my mind. (I use rectangular prisms, nested like Russian dolls, in primary colors, megabytes upon megabytes of them, and the tiny little strings that are actually useful data are glowing, everything else is dusty-translucent.)
I’m also going to literally println a CSV file on the other end, throw it in a Scheduled Task (no, I didn’t say cronjob), and move on to a more important project.
Using the snippet is the right choice for this part of this project. All I need are those little (glowing) strings.
I like the way nannou apps are structured: https://github.com/nannou-org/nannou/blob/master/examples/template_app.rs
Certainly does! Started playing with relm (https://github.com/antoyo/relm) for small experiments, but this seems more suited to Processing like stuff while providing a nice structured UI API. Thanks for sharing!
Still a cool language because of its simplicity and compilation speed (it influenced Go but is much simpler), its syntax is heavily dated though. I sometimes rewrite a code fragment from another language in Oberon (using OBNC) for educational purposes, if I am able to express it in Oberon and get the compiler to accept it, I feel that I truly understand it.
I always thought a good project for students was to make an Oberon with C-like syntax. Keep safety in by default with “unsafe” keyword to turn it off in modules or blocks. Compile to assembly for full experience, to LLVM to learn that, or to vanilla C for use of many compilers. Also, give it macros. Every system language needs macros since they can solve so many problems. Gotta use them sparingly and carefully for code readability but some times they’re best solution.
Also, give it macros. Every system language needs macros since they can solve so many problems. Gotta use them sparingly and carefully for code readability but some times they’re best solution.
Definitely a good exercise for learning to code and navigate the code of a real world compiler.
But, while I use C macro whenever a call seems as an unjustified waste of resources and I am not a macro detractor at all, I think that the whole point of Wirth’s work with Oberon design would be completely lost in the translation to a language with macros.
Lisps apart, macros (and metaprogramming in general) are a form of code generation that could be moved outside the language. Apparently they are embedded in the language for convenience, to reduce the complexity of the build process, but this let a whole branch of code generation techniques unexplored.
“Apparently they are embedded in the language for convenience, to reduce the complexity of the build process, but this let a whole branch of code generation techniques unexplored”
People explored all kinds of methods. DSL’s for many languages were external. LISP’s were among few to internalize them. They maintained an advantage of consistency over the rest.
Well I was not thinking about DSLs that serve specific purposes.
By metaprogramming I was referring to those tools, such as macros, C++/Haskell templates, C# generics and so on, that basically generate code that is later compiled (either on binary generation or by a JIT compiler in the VM).
Such preprocessing is usually integrated in the compiler suite (even in Lisp, where expansion occurs on read, if I remember correctly), and consequently integrated in the language.
I’ve never seen people writing code in X to generate code in X.
My insight is that this would be the Oberon approach to metaprogramming… but I have no proof this is what Wirth intended.
Also this might be a selection bias or plain ignorance on my part.
Do you have any example to share?
I had some stashed links on metaprogramming and reflection in Oberon. I think I just skimmed them cuz I don’t recall the specifics. Maybe posted them somewhere. Anyway, I had saved Metaprogramming in Oberon from 1994 and had a bookmark on Reflection in Oberon a few years later. Maybe you’ll find them interesting.
its syntax is heavily dated though.
At a first glance, uppercase keywords gave me the same impression.
But actually they serve the same purpose of syntax highlighting without… syntax highlighting.
Is there anything else that make it seem dated to you?
Or, in other terms, what do you mean by “heavily dated syntax”?
With “heavily dated syntax” I mean that the syntax is reminiscent of the Pascal/ADA/Eiffel era, nothing wrong with that but most developers will probably think it’s ugly, archaic and verbose. Adopting a syntax looking more like Nim will be more forgiving to developers who are new to Oberon IMO.
In addition Oberon could be a lot more expressive with just adding a pipeline operator (as sugar for nested procedure calls):
cart := emptyCart |> AddItem(42) |> MakePayment(73.95)
I use the compiler explorer quite regularly and it is really a brilliant tool. Although for deeper diving I use cargo-asm (or just profile and look at the assembly) for short explorations to answer the question ‘what would rustc/gcc/clang/… compile this to?’, the compiler explorer is really awesome.
This was quite and interesting reading!
It would be interesting to see also an example that deals with more complex ocaml structures, like records containing strings, bytes, and (why not) arrays or lists. Or maybe a GADT. Although I think it would just make the plumbing More complex but be not much more than what you do writing the usual C bindings
I would love to see a language like OCaml (or another ML like dialect) to be able to make use of Rust’s emerging ecosystem, but I’m afraid we’re still a long way from seeing that happen. Also check out Gluon http://gluon-lang.org/ for an ML like language embedded in Rust (personally I’d prefer a standalone language that works with Rust though).
I’m a little confused. Outside of being developed in Rust what makes gluon “embedded in Rust” vs a “standalone language”? It appears that while gluon is heavily influenced by Rust it can, and does, function as a standalone language as well if you wanted it to. Which, as they point out, is similar to lua.
I feel like embedded in the context of gluon only applies to their goal of being easy to embed as opposed to being embedded itself.
I agree that it ‘can’ function as a standalone language as well. But I am not sure if I agree it currently does, AFAIK you can’t create a gluon ‘script’ that runs with
#!/usr/bin/env gluonand neither can you compile a gluon source to a binary without embedding it first in a Rust application. I am also unsure whether you can write a gluon module using rust and then import it from your ‘standalone’ gluon program.So I disagree that embedded in the context of gluon only applies to their goal of being easy to embed as opposed to being embedded itself.
But I do realize my criticism might be easily solved (although I have some doubts about the ‘write a gluon module using rust and then import it from your standalone gluon program’ part).
Please correct me where I am wrong, I’m fairly new to both Rust and Gluon.
Ditto. Thanks for clarification.