5 ms·
Perhaps you'd enjoy Nim which supports both. echo "hello world" echo("hello world") and as a bonus, also the following: "hello world".echo
by dom96 9y ago
Perhaps you'd enjoy Nim which supports both.
echo "hello world"
echo("hello world")
and as a bonus, also the following:
"hello world".echo
- FRex 9y agoLua does too, for literal tables and strings being sole argument you can omit parentheses. But to call method on a literal you need to add them. > print("OK") > print "OK" > ("OK %d"):format(1) I've seen some funky (ab)use of these, people using literal strings and tables and functions named class and similar to do: > class "Something" { > -- ... > }
- jmaa 9y agoThis is one of the reasons I love Lua. I'm constantly pleasantly surprised by Lua. It defines a few simple primitives, and allows you to do whatever you want with them, even to the absurd. Hell, it even allows you to do this: > somefunc "1string" "2string" "3string" > somefunc {} {} {}
- scrollaway 9y agoI'm a primarily Python dev, have been for a long time. Lately I've been working in Javascript/typescript and there is no worse antifeature than having 3 different ways of doing the same thing. You try to figure out how to do something, you see 3 different solutions and you ask yourself, what's the difference? What's more correct? Will I need one over the other? Are they compatible? Is one way better supported than the other? The amount of time I've spent looking up differences between two APIs or two paradigms in Typescript is seriously ridiculous. And it feels really bad to not recognize something you've done before because it's written differently. Common culprits: require() and imports, the countless ways of creating classes, the crazy amount of different ways to implement similar or identical workflows in webpack and pretty much the entire JS ecosystem in general.
- indigo0086 9y agoAs a primary js developer (about 10 years) who in the most recent two years has done more and more es6 work I will revel in the day I don't have to use it in my day to day. I toy with clojure in my free time and even python and just hate the way the JavaScript language has been taken over not just by trends but with what I think are poorly thought out syntax additions. JavaScript seems like a language that has no opinion on the best way to do a thing, no well thought out constructs to eliminate boilerplate, and just sits there and waits for a Bower, and mom, a lodash, or a Babel to come along and tell it hoe to be a proper language.
- girvo 9y agoI feel you on the JS/TS front, but to be honest it's somehow less of an issue in Nim. Not sure why, but everyone does really follow some pretty simple conventions.
- stephengillie 9y ago> [T]here is no worse antifeature than having 3 different ways of doing the same thing. Ironically, this is touted as a strength of Powershell. Speaking of which, this code supports none of Powershell's Write-Host variants.
- yen223 9y agoPython 3 now has 3 similar-but-different way to format strings. Python is definitely heading down a bad path.
- TuringTest 9y ago> You try to figure out how to do something, you see 3 different solutions and you ask yourself, what's the difference? What's more correct? Will I need one over the other? Are they compatible? Is one way better supported than the other? I've always wondered this: would it be that bad, if you could easily guarantee that all those formats really are equivalent? (maybe by being able to check a unique identifier of the function to which the expression is going to be compiled). In the case of this library, the semantics are simple and clear: I have a string object, and I want its contents to be poured on a predefined output device; maybe converting on-the-fly some escape characters in the string to the values of some parameters. Provided that you don't deviate from this specified meaning, is it that bad that the language accepts any common syntax? I understand the "being harder to recognize what it is doing", but I think that might be somewhat alleviated by the feature I said above of unambiguously resolving to a single entity in the programming language.
- epalmer 9y ago>"hello world".echo Okay I have to admit I love this one.
- mhh__ 9y agoUFCS. Also found in D. And, frustratingly, did not get past the C++ committee.
- skocznymroczny 9y agoIt gets better with chained function calls, e.g. (D-like pseudocode): writeln(mul(add(x, 5), 30)) vs. x.add(5).mul(30).writeln()