• TS (unregistered)
    /****************
    *  Easy reader version:
    *  #####################
    *  # Easy Reader Version
    *  # // Easy Reader Version
    *  # // ' Easy Reader Version
    *  # // ' REM Easy Reader Version
    *  #####################
    *****************/
    -->```
    
  • Dennis (unregistered)

    Seems a bit like the average Wordpress plugin. And I can't even say that I've done much better myself, just seems to be the standard, terrible, WP way.

  • Tim R (unregistered)

    This type of approach is par for the course in any environment where you've got server-side and client-side script going on (i.e. most web apps). The best (only?) way to avoid it is to use a framework that lets you use the same language on both client and server e.g. nextjs or blazor

  • (nodebb)

    some JavaScript code that modifies a CSS class

    No it doesn't. It adds a CSS class to some HTML elements.

  • (nodebb) in reply to TS

    Bravo.

  • Robin (unregistered) in reply to Tim R

    You do realise that there's absolutely no need to have Javascript for this at all? It's just statically adding an HTML class at load time, based on some state on the server - that both can and should be handled entirely on the server side to build the appropriate HTML either with or without the class.

  • (author) in reply to Tim R

    No, do not do this, even if you're using the same language on both sides. The HTTP request is a natural module boundary, do not cross that boundary except through a well defined interface, for example, an XMLHttpRequest. If you really need to pass parameters from the server side to the client side in the document, serialize the parameters to JSON and embed it as a variable, e.g. let _serverSideParams = <% toJson(myDictionary) %>;.

  • Quinn (unregistered) in reply to TS

    "I mean, if you're working in LISP, 90% of your program is going to be macros"

    Even in lisp the rule is to only use a macro when you really need to. At least in scheme, common lisp and clojure writing a macro when a function would suffice is a big no-no

  • Scragar (unregistered)

    The PHP code embeds an HTML tag

    a HTML tag

  • (nodebb) in reply to Scragar

    Someone flunked Pedantic Grammar 101 . Yes, 'an' before 'h' is gramatically correct usage. Most of the time nobody cares.

  • Conradus (unregistered) in reply to Scragar

    No, "an HTML tag" is correct. You use "an" when a word starts with a vowel sound, which "HTML" (pronounced "aitchtee-emell') does.

  • Tim R (unregistered) in reply to Remy Porter

    In React with server-side rendering, to avoid the delay when the app initially loads, you want to render the initial DOM on the server complete with content, then once it's in the browser, you fetch and render updates using AJAX. Unless you're using a framework like Next.js that lets you use the same code on client and server, you're writing the exact same code twice.

  • (nodebb) in reply to cellocgw
    Someone flunked Pedantic Grammar 101 . Yes, 'an' before 'h' is gramatically correct usage. Most of the time nobody cares.

    And to be even more pedantic the reason for this is because 'h' makes an 'a' sound when pronounced and since you use 'an' before vowel sounds this is why it's "an HTML tag".

  • (nodebb) in reply to Scragar

    An aitch tee emm ell tag. So yes, "an HTML tag" is correct. Sheesh.

  • (nodebb) in reply to cellocgw

    Yes, 'an' before 'h' is gramatically correct usage.

    No. "An hotel", "an herb", "an hero", etc. are not correct usage.

  • Lurk (unregistered) in reply to Steve_The_Cynic

    "An hotel" is a correct usage in the UK. It is rather old fashioned, but it is correct.

  • Brian Boorman (unregistered) in reply to Steve_The_Cynic

    I believe they said "an before h", not "an before a word starting with 'h'". Your effort to prove them wrong is wrong itself.

  • NotAThingThatHappens (unregistered) in reply to Steve_The_Cynic

    The French are famous for not pronouncing a 'starting h'. In English/American the 'h' is also sometimes supressed/silenced. Case in point "herbs" can be pronounces as 'erbs. (uurbs) I have never heard anybody pronounce "HTML" as 'MTL (um tee el)

    Language is messy.

  • Officer Johnny Holzkopf (unregistered)

    "Meta-programming- programs which generate programs- [...] usually shouldn't be used in production code." - People still remember RPG, right?

  • Duke of New York (unregistered)

    My sympathies to the person who implemented syntax highlighting for this code.

  • (nodebb) in reply to NotAThingThatHappens

    Some Brits do pronounce "h" as "haitch" though, rather than "aitch".

  • i (unregistered) in reply to NotAThingThatHappens

    Let's say HTML is an messy language.

Leave a comment on “Metaception”

Log In or post as a guest

Replying to comment #:

« Return to Article