3 ms·
> JScript supports conditional compilation, which allows a programmer to selectively execute code within block comments. I found this bit to be of particular i
by gillytech 5y ago
> JScript supports conditional compilation, which allows a programmer to selectively execute code within block comments.
I found this bit to be of particular interest. Why would anyone want to selectively execute code within a comment block? That seems to me to be a Bad Idea™
- zamadatix 5y agoEarly method of making the script run one way in IE and another way in a different browser, also had some predefined variables for handling versions and whatnot. You may remember the same feature but for HTML: <!--[if IE 6]> Obviously modern HTML tags with fallbacks, @supports in CSS, and proper feature detection instead of hardcoding are the better approach nowadays since everyone finally agreed to follow the standards reasonably closely and you don't need version specific hacks rather just checks that something is supported.
- gillytech 5y agoOkay that definitely makes more sense. I use those IE conditional comments to this day in email templates (for Outlook). You know you have a problem when you need to alter web standards in order to let programmers get around your alterations of web standards. As a new HTML coder back in the day these conditional comments were really odd to me. Thankfully we don't have to deal with that much anymore although IE 11 is still out there, lurking.
- anothernewdude 5y agoC supports conditional compilation, where it's great for supporting multiple architectures and operating systems.
- bryanrasmussen 5y agowell sometimes people want to selectively run code in a dev instead of a prod environment. I wouldn't say it's a bad idea, it is a possibility we sometimes need that it would be preferable that we did not need and we should try to get away from needing quickly if we find ourselves in that situation.