-4
\$\begingroup\$

Perhaps, HTML, CSS and JavaScript have the most number of interpreters. Every browser is an interpreter of them. And each interpreter varies significantly in terms of implementation of certain aspects of these languages. And since languages are defined on the basis of their implementation, not specification or documentation, this raises an issue.

So, I think we should define some standard interpreter. If your solution in these languages works fine on it, then it's valid, otherwise not. One possible way to do this can be making Stack Snippets execute on the server rather that Client's browser (on PPCG at least). The Snippets can take in source code and get it executed remotely on the server. They can, then, send back the result as an Image Map and some cross-browser-compatible JavaScript code that handles the events like clicking, hovering etc. Doing so will cause consistent results with the interpreter present on the server, no matter which browser you are visiting the page from. But I do understand that redefining a full aspect of Stack Exchange network won't be too easy.

Alternatively, TIO Nexus can have HTML and CSS options along with the other languages (JavaScript one is already there). But I also understand that writing a parser for two broad languages can be tricky.

Another solution that can be is making a browser (like Chrome, Firefox) etc., which exactly follows the specifications of these language. The BOM methods and properties can be discussed in another Meta post.

I admit that all the solutions above will be very hard to implement and most probably will never get implemented (I added them just for the sake of some probability that still turns in favor of them being implemented). So, on the very least, we can define a browser (such as Chrome v58.0.3029, Firefox v53.0a1 etc.) as the standard. In other words, we can examine the validity of a solution by only running it in a browser that we can agree upon in another Meta post.

So, what do you think about these suggestion? Should any one of these be implemented? If yes, then which? If not, then why not? Please post your ideas as answers. Consider adding a comment when you downvote.

\$\endgroup\$
1
  • \$\begingroup\$ It is ok follow the standards; but if they are too much big; or propose one language more complex than it could be, it is better find one subset of them that not has problems \$\endgroup\$
    – user58988
    May 7, 2017 at 6:14

2 Answers 2

10
\$\begingroup\$

Perhaps, HTML, CSS and JavaScript have the most number of interpreters.

No arguments there. The vast amounts of inconsistencies between different browsers, or even different versions of the same browser, can be anything from mindboggling to infuriating.

And since languages are defined on the basis of their implementation, not specification or documentation, this raises an issue.

It does not.

Languages being defined by their implementations means that there has to be one interpreter that makes your code do what it's supposed to do. If a certain answer works only in a certain browser, it is the responsibility of the author to state so in their answer.

So, I think we should define some standard interpreter.

And how would you do that? Even if you pick a specific implementation, that implementation will suffer changes over time.

One possible way to do this can be making Stack Snippets execute on the server rather that Client's browser (on PPCG at least).

I can't speak for StackExchange, but I'd be willing to bet that this is not going to happen.

Alternatively, TIO Nexus can have HTML and CSS options along with the other languages (JavaScript one is already there). But I also understand that writing a parser for two broad languages can be tricky.

Re: JavaScript

TIO uses Node.js. Node.js will eventually get updated, so you have the same problem as you did before.

Re: HTML and CSS

And how is TIO supposed to display the output in the browser? The normal way would be to use HTML and CSS, but that brings us back to square one. Aside from turning the output into an image (or a GIF if animation is involved), I'm not sure how this is supposed to accomplish anything...

Another solution that can be is making a browser (like Chrome, Firefox) etc., which exactly follows the specifications of these language. The BOM methods and properties can be discussed in another Meta post.

Multi-billion dollar corporations and huge open source projects have a hard time writing a decent web browser. And even with our best intentions, being 100% standard-compliant seems practically impossible with the vast amount of features and edge cases such a browser would have to support.

So, on the very least, we can define a browser (such as Chrome v58.0.3029, Firefox v53.0a1 etc.) as the standard.

What if a user doesn't have access to that specific browser? What if/when the browser becomes obsolete and nobody would naturally have it installed anymore? What if a critical bug is discovered and no one in their right mind would keep using that browser?

TL;DR

I disagree with your premise and don't consider the current situation problematic. And even if I did, there is no reasonable alternative to every implementation is its own language.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Okay, I get it now. Sorry for wasting your time. \$\endgroup\$
    – Arjun
    May 5, 2017 at 6:36
3
\$\begingroup\$

I'm not in favor of this proposal, because it doesn't seem to add anything to me. The current solution is "Specify which browser(s) your answer works in". It's perfectly reasonable to say "This is a Chrome Javascript answer", or even specify a version of Chrome if necessary. I've seen answers do this when, for instance, they wanted to use a specific feature only implemented by the spidermonkey javascript engine. I'm in favor of continuing that policy.

All I see this proposal accomplishing is banning some otherwise valid and interesting answers and engendering pointless arguments. I don't see it adding anything.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .