Consider something like:
foo ? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
I was hoping that was where the post was going with this :)Sadly, JavaScript doesn't have the // operator (floor division) so it doesn't quite work. And double-sadly, I can't think of a language that has all the necessary ingredients; Python uses `and` and `or` for trinary syntax, not ? and :, and besides, you'd need to be able to overload the // operator as unary rather than binary, which ... well, I'm not sure we'd want a language to be able to do that. But I do!
Still, if you want to confuse your coworkers, consider sneaking in something like:
developer = {mozilla: 42}
en = US = docs = web = Web = JavaScript = Reference = Statements = label = 420
console.log(developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label)
and be sure to hand in your resignation after pushing the commit.This is valid Perl code syntactically, except Perl complains of invalid or incompatible regexp modifiers.
So, if you chose the characters carefully an url like that could be executable in Perl (but not this one or urls in general).
But maybe you're thinking of this - https://metacpan.org/pod/Acme::URL
use Acme::URL;
print https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label; developer = {mozilla: {org: 42}} ?A nitpick: Python uses `if` and `else` for trinary syntax:
a = foo if bar else baz foo ? https:/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
which of course isn't as cool. Still pretty close though.Well, unless your code relies on an `http` or `https` label :)
Whenever I use the Regex engine of XML Schema (or later XPath), with the regular expression shown in RFC3986 - Uniform Resource Identifier (URI): Generic Syntax, I get the error: "Regular expression matches any string.". (The reason for this being an error is, that the XSD regex engine had only one purpose: to constrain a string, so we can check for valid input or define a datatype. That's why it behaves that way.) Here is the part with the regex from Appendix B[1] of aforementioned RFC:
The following line is the regular expression for breaking-down a
well-formed URI reference into its components.
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
12 3 4 5 6 7 8 9
The numbers in the second line above are only to assist readability;
they indicate the reference points for each subexpression (i.e., each
paired parenthesis). We refer to the value matched for subexpression
<n> as $<n>. For example, matching the above expression to
http://www.ics.uci.edu/pub/ietf/uri/#Related
results in the following subexpression matches:
$1 = http:
$2 = http
$3 = //www.ics.uci.edu
$4 = www.ics.uci.edu
$5 = /pub/ietf/uri/
$6 = <undefined>
$7 = <undefined>
$8 = #Related
$9 = Related
where <undefined> indicates that the component is not present, as is
the case for the query component in the above example. Therefore, we
can determine the value of the five components as
scheme = $2
authority = $4
path = $5
query = $7
fragment = $9
[1]: https://datatracker.ietf.org/doc/html/rfc3986#appendix-BWay back in the day, I used to write labels like `<a href="javascript:open_save_dialog:;">` instead of `<a href="javascript:void(0)">`. The idea is that both yield undefined to prevent the default URL following semantics of the link, to instead do whatever JS logic is attached to the onclick event, but when the user hovers over the link, the label makes the corner tooltip of the browser show descriptive information to the user about what clicking will do, whereas `void(0)` tells you nothing.
await www.example.org
as demonstrated in a tweet[1]. This is pretty interesting IMO :-)[0]: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Refer...
[1]: https://twitter.com/rreverser/status/1138788910975397888
For eg. in Red console:
>> read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
== {<!DOCTYPE html><html lang="en-US" prefix="og: https://ogp.me/ns#"><head><me...(aka Intrinsics?)
() => {
foo: "bar";
baz: "qux";
}
Thankfully TypeScript warns me it's a ()=>void function instead of whatever was expected in the context. I scratch my head for a while and then remember: () => ({
foo: "bar",
baz: "qux"
}); foo: "bar";
is a valid expression. I know, it's the named statement syntax normally used for loops, but I didn't know this worked for any expression. function foo() {
<!--- returns true ---->
return true;
}
This works at least in Chrome and V8, not sure about Firefox. data:document/document,alert('hi')
If ran as JS it will alert "hi". If put into a link it will force the browser to download a document containing the alert statement.e.g. running the above in Node gives:
Uncaught ReferenceError: document is not defined
For anyone unfamiliar with JS, the above string is parsed as: (label):
(variable cast to int) / (variable cast to int), // evals to NaN
(function call) // evalshttps://svelte.dev/docs#3_$_marks_a_statement_as_reactive
Is Svelte doing something clever with these labels at runtime, or is it just using the label to do some kind of transformation when the javascript is compiled, anyone know?
The following doesn't seem to be valid though. :( Am I missing something?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
let a = 1;The rationale here is that the variable goes out of scope right away due to the implicit block, so they made it a syntax error so that you don't waste time pulling your hair out debugging issues downstream from this line without realizing this scope-related obscurity. (This also has potential security implications e.g. if you think you're shadowing a variable from a parent scope but you're not)
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
10
<- 10
```
Eg, this is equivalent to:
```
>> https: 10
```
What I did not know is my code was more or less secretly reviewed by a senior engineer, who was a bit surprised, but learnt something he told me.
This is how the secret review became public. My red pill, indeed!
edit: typo
Objective-S makes URIs useful: http://objective.st/URIs/
Unused label.ts (7028)
'https:' is defined but never used. (eslintno-unused-labels)
Delete `https:` (eslintprettier/prettier)However, this "feature" turned out to be misfeature and may be removed in future.
The RFC: https://github.com/NixOS/rfcs/blob/master/rfcs/0045-deprecat...
Or: Ceterum autem censeo Javascriptum esse delendam.
It makes the article unreadable...