@mousetail The whole point of this argument is use vs. using and I'm arguing for use. If you also think it should be use, why are we even discussing this?
Thus, the use changes something. And it's not changing me, and it's not changing the rest of the world, it's changing how the compiler understands the code
i'm interested :P do you just make a graph of all the imports, then smash all the nodes together and let the edges just determine visibility between them
(I still had arguments left but school WiFi went out)
(That was a rather dumb argument so probably a good thing; I think it just came down to a different view of what counts as an "action" and given the immense vagueness of the word I don't think doing so much makes sense)
That's actually a big priority, since the language is intended for beginners they'll be asking questions lots so it would be helpful it it had some debugging info for when they ask me stuff
Note the language is intended for quick prototyping for people with less experience, not for teaching absolute beginners. It's probably too high level for that
@UnrelatedString tinylisp 2 is interpreted, so importing a file is basically equivalent to executing it. The interpreter keeps a list of the files that have been imported so far, and if you import a file that's on the list, it doesn't do it again. Since 95% of what's in the libraries is function definitions, whose bodies aren't evaluated until they're actually called, it doesn't really matter which definition gets executed first, and so everything just works.
Although I somewhat like the idea of [1], [2], etc. so you can reference specific lines by number. Even better if you can access the return value of a line by number.
Also rant about python where there is no prompt for line continuation causing your lines to be misaligned which is a terrible choice for a language where indentation is important
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(
... "hello"
... "world"
... )
helloworld
>>>
I was going to upload a gif of the prompt to make it a bit clearer what happens but it's not working so instead I'll tell you to download Crosshatch and try it out yourself :p
Both Firefox and Chrome's JS console prompts use images instead of characters, but Firefox's prompt looks like » (← for results), while Chrome's looks like > (<· for results). Neither of them has a continuation symbol.
function f(a) {
b = a.map((_, i) => a[i])
while (true) {
x = Math.floor(Math.random() * b.length)
y = Math.floor(Math.random() * b.length)
if (x - y) { k = b[x]; b[x] = b[y]; b[y] = k }
if (a.every((x, i) => a[i] == b[b.length - i - 1])) return b
}
}
technically speaking I believe the if (x - y) is actually worse because for larger numbers it's an almost entirely unnecessary check and for smaller numbers it runs more often thus preventing branch prediction from working
Hmm, even if you use === there's still a bug: if you try to reverse an array that contains NaN, it infinite-loops because NaN === NaN is false.
JS is like a path through a swamp that doesn't have guardrails and isn't always marked very clearly. If you step off the path by accident, you might be fine, or you might be swallowed by quicksand. But as long as you stay on the path, you're good!
SFINAE: the default argument can be used when T is an integer type, but doesn't cause an error in other cases. You can still say print("Hello") because you're not using the default argument as a string
template<class T>
void iDontLikeIntegers() {}
template<>
void iDontLikeIntegers<int>() {
static_assert(false, "I said I don't like integers!");
}
specialization: because all templates are resolved at compile time, you can do things like this