Is there any situation where you’d want to remember the opcodes? Disassemblers should give you user-friendly assembly code, without any need to look at the raw numbers. Maybe it’s useful to remember which instructions are pseudo instructions (so you know stuff like jz
(jump if zero) being the same as je
(jump if equal) making it easier to understand the disassembly), but I don’t think you need to remember the opcode numbers for that.
Edit: Maybe with malware analysis where the malware in question may be obfuscated in interesting ways to make the job of binary analysis harder?
I wouldn’t trust ChatGPT with teaching me about some tool. It in my experience very convincingly spews out stuff it invented, and if one is still learning I can see it being hard to spot those errors. I use it to fix syntax errors in SQL queries, though, since I can’t be bothered to try understanding the not-so-helpful error messages I get with my queries, and because if chaptgpt tells a lie it will be caught by my syntax checker.
So, I guess you can use it, if you always assume it to be trying to mislead you until proven to the contrary.
Some people use tabs for indentation and spaces for alignment. It kind of gets the pros of tabs (user configurable indent-width) and the pros of spaces (alignment). That doesn’t work in Python where you can’t align stuff and the interpreter doesn’t allow mixing tabs with spaces, but in other languages it is a possible style.
I wrote this after I learned about attempts to use Scheme as the lingua franca of Web in the early 90s. Someone told me S-Expressions are bascilly XML and well, he’s right.
https://lemmy.ml/comment/8713988
Was it this exchange? :D
I also leave every firefox tab open until I run out of RAM, at which point I use the “close tabs to left” button, moving some tabs that I still want to check out to the right beforehand. On firefox, one can simply use the list all tabs button to easily navigate or search through all tabs, so no memorization is needed (or just type the title of the document in the address bar and it will just switch to the tab if you have it open).
Languages like C have a preprocessor. The preprocessor preprocesses the source code before compiling it. The C preprocessor, copy-pastes code from other files into the current file (#include
s), erases code (#if
if the condition is false), and expands macros (e.g. you have #define MAX(x, y) ((x) < (y) ? (y) : (x))
, it replaces every use of that macro with the definition of that macro: a += a * MAX(b, c)
→a += a * ((b) < (c) ? (c) : (b))
. There are also general-purpose preprocessors (or macro processors), that are not tied to a specific programming language however. m4 is one of them and GNU autotools make extensive use of them to generate their configuration and make files. What preprocessors allow one to do is write a template, and then generate a result, based on your needs.
The opposite is true, though. If you use tabs for indentation and spaces for alignment, you can adjust the tab width without destroying alignment. That’s the big benefit of the tabs-for-indentation-spaces-for-alignment mix.
You can’t do that with only tab characters, you can’t even align stuff with tabs because it has variable width.
Is it just me or does vamp.sh fail with an error on firefox?
git add -p
is great to know, but IMO one shouldn’t rely on it too much, because one should strive committing early and often (which eliminates the need for that command). Also using git add -p
has the risk of accidentally not adding some code that actually belongs to the change you are trying to commit. That has happened to me sometimes in the past and only later do I see that the changes I commited are broken because I excluded some code that I thought didn’t belong to that feature.
Same for merge conflicts. I’m not sure you can even resolve them on the CLI
How are they solved when using a GUI? When using cli, it simply tells auto-merging failed and you can open the conflicting files in a text editor and solve the conflicts, then add them and continue the merge.
Managing branches: perhaps I’m a little too ott but I keep a lot of branches preserved locally, a GUI provides a decent tree structure for them whereas I assume on the command line I’d just get a long list.
git log --graph --all --oneline
There’s also --pretty, but it uses a lot of screen space.
Managing stashes: unless you just want to apply latest stash (which admittedly is almost always the case) then I’d much rather check what I’m applying through a GUI first.
You can attach a message when stashing with -m
.
And you can check them out by doing git checkout stash@{1}
or similar.
But it is in no way worse than javascript in that regard, though?
I don’t think static typing in Python is really so essential. I see it above all as a scripting language, so its applications don’t benefit as much from static typing as other languages do.
Maybe a better hypothetical python would have used some kind of type inference system, like in haskell, which allows for static typing while still allowing to write code unencumbered from types and stuff, but I really think, for Python’s target domain, its type system is actually adequate or good. Maybe its documentation could benefit from type hints, though.
I haven’t worked with any 1-based indexing languages, but I can’t really see how it could be problematic. The only advantage I see about 0-based indexing is the simplicity in how the memory address is calculated. Just arr + index × sizeof(member)
which I think even has its own MOV instruction on x86. But besides that I can’t see any more advantages. With 1-based indexing I see the advantage of the number of elements also being the index of the last element of the array, avoiding off-by-one errors when writing. Though, again, I’ve never used a 1-based indexing language.
If by «loosely typed» you mean weakly typed, then that’s not true. Python is a dynamically and strongly typed language. Attempting to do an operation with incompatible types will result in a TypeError.
>>> "3" + 9
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate str (not "int") to str
You may be thinking of the following, but this only works because the __mul__
and __add__
methods of these objects have been written to accept the other types.
>>> "A" * 4 + "H"
'AAAAH'
I’m not sure, but I think that might have been part of the joke, seeing all the comments here.