Does anyone feel like life would be easier if we just used the right tool for the job instead of hacking together solutions?
Me either. So do we want a single standard or should we make 5 "technically compatible" ones with names that are functionally identical, save for some tiny detail?
Well, you know, I could use the standard library, but it wouldn't be tailored to my use case.
My own configuration parsing library is written by me so it doesn't suffer from the common "not invented here" issue, which as we all know is a fatal flaw....
I swear if I have to deal with another set of really shitty tools made by a dev in the 90s that hasn't been updated since 2005 and has never been used by anyone outside of one specific company and has an interface that makes me BEG for a command line interface to save me from the BRIGHT FUCKING WHITE WITH LIGHT GRAY BOXES I'm just going to become a printer salesman. Can't beat em, and all.
I hate JSON and XML for configs, they are data exchange formats, who decided that they should be used for configuration? I get it when you need to create a logical structure but not a simple configuration.
- Brought to you by your local TOML master race gang.
PS:
fuck YAMLs significant whitespace
- Brought to you by my personal hate for significant whitespace
XML, the readability of a machine interface, with the compactness of a human interface.
XML: we made it hard to read for humans, but ALSO hard to parse for machines.
XML: because we hate you, that's why.
Use yaml for configs, not json. Json is not supposed to be used for configs and isn’t meant for human readability. Yaml also got that comment functionality everyone likes
Wait are you endorsing JSON for human readability and config files or not? How many fingers an I holding up? Does it matter if a human ever has to read the config file?
Yeah I know, but the only way to get any form of comments in pure JSON is hacky workarounds, unless you use a different format which supports comments like JSONC or YAML
There’s not a lot of parsers which support it though. For JavaScript in the browser and on node they implement the `JSON.parse()` function from the JavaScript spec which doesn’t have support for comments, and that’s what most devs will use
Not a lot != None
I honestly dunno about JS since I avoid it like the plague, but I am pretty sure you can either find something or just load a file and preprocess it yourself
I stand corrected, it looks like Microsoft provides their one which I’m guessing is the same one they use for vscode, so I guess that’s a good alternative. I don’t know if that’s the case for other languages
https://www.npmjs.com/package/jsonc-parser
C# built in parser supported block comments initially and added line comments in v6
Newtonsoft had them since forever and can even load them as separate special values if you want
I rebind my editors to `Ctrl + q` so I can do it with one hand. Also, muscle memory from that being the default in SciTE, which was the first editor I used a bit over 15 years ago.
As usual vim has a quicker method but it requires 3+ keybinds to use
Ctrl v to enter block mode and select all lines then shift i to enter insert mode and insert // or # or whatever, doesn't auto do html or anything like code but lets be honest nobody using vim is coding in HTML a whole bunch.
Vim users probably only code in RUST or Ziggy or Brainfuck lets be honest
it depends, if you want to comment all lines inside the block you can select by just pressing `vi{` that is much faster than using the mouse or shift-arrows
Holy crap. This is programmer humor.
I made a reference to a classic XKCD and added a smiley face. You guys are wound up pretty tight if you couldn’t see that’s tongue in cheek.
Fuck this.
> {/* WebStrom */}
> {/* will */}
> {/* comment each line this way */}
>{/* And VsCode
>Comments like this */}
And Select + remove comments doesn't work.
'COMMENT' This is a comment in ALGOL. It is terminated by a semicolon. ;
'COMMENT' Know what else is terminated by a semicolon?
Y:=X+1;
'COMMENT' Every other bloody line of logic, which means the above line of logic was never performed.;
I didn't ever learn ALGOL directly, but there's a large family of languages that are closely based on it. I learned one of those and worked with it for years.
I learned it because it was the only implemented high level language for that system. I think the biggest ALGOL-decended language is Pascal, so I'd go for that
; also used for commenting in MUMPS.
for loop=1:1:10 do
.;things, but don't forget, when you're in a loop, the comment goes at the number of dots you are
.;at in the loop, or the loop ends right there AND the interpreter will not warn you that has happened!
.quit
quit
I remember my first internship at a company that had two developers and one of them saw me comment out some tag and I got told off for them being "horrible wordpress things"
rem Commenting in BASIC or batch files
:: not really a comment in batch files, but can be used as one, and (something I read when I was a kid), its slightly faster since rem is an actual token that has to be parsed, and :: is a malformed label and is ignored.
:: i'm not sure how true that is though.
I'm learning Ruby on Rails right now and commenting in the HTML template files (`.erb` files) is such a pain in the ass. Sometimes you'll comment something out and it will evaluate the expression anyways. It defeats the entire purpose of a comment! Plus, there are two ways to comment - first is by using an HTML comment `` and the second way is by commenting the Ruby statements `<% #comment here %>` and both of them seem to still create bugs. There's probably something I'm missing but it's certainly not intuitive.
Just wait for language that makes the opposite to make easy write comments. You will prefix code with some character and lines without prefix will be treated as comments - multiline comments solved automatically.
`
{{'' // why do that when you can bind comments}}
But, but, why didn't you comment your JSON file?
We don't talk about comments in JSON, no no no.
but it’s so good for configs otherwise :(
{ my_config_value: 42, my_config_value_description: "we don't talk about Bruno" }
Istg if I ever make a JSON loader I'm supporting C-style comments in and no one can stop me.
Just run it through the C preprocessor first. As a bonus, your JSON now supports `#include` directives and C-style macros.
Wonderful idea. Next up we need include directories while parsing so we should standardise on cmake to solve that problem.
Does anyone feel like life would be easier if we just used the right tool for the job instead of hacking together solutions? Me either. So do we want a single standard or should we make 5 "technically compatible" ones with names that are functionally identical, save for some tiny detail?
Well, you know, I could use the standard library, but it wouldn't be tailored to my use case. My own configuration parsing library is written by me so it doesn't suffer from the common "not invented here" issue, which as we all know is a fatal flaw....
I swear if I have to deal with another set of really shitty tools made by a dev in the 90s that hasn't been updated since 2005 and has never been used by anyone outside of one specific company and has an interface that makes me BEG for a command line interface to save me from the BRIGHT FUCKING WHITE WITH LIGHT GRAY BOXES I'm just going to become a printer salesman. Can't beat em, and all.
JSON5 supports # comments I believe
JSONC entered the chat
Damn you! Now that song is in my head again
I hate JSON and XML for configs, they are data exchange formats, who decided that they should be used for configuration? I get it when you need to create a logical structure but not a simple configuration. - Brought to you by your local TOML master race gang. PS: fuck YAMLs significant whitespace - Brought to you by my personal hate for significant whitespace
XML, the readability of a machine interface, with the compactness of a human interface. XML: we made it hard to read for humans, but ALSO hard to parse for machines. XML: because we hate you, that's why.
Use yaml for configs, not json. Json is not supposed to be used for configs and isn’t meant for human readability. Yaml also got that comment functionality everyone likes
🤓
Wait are you endorsing JSON for human readability and config files or not? How many fingers an I holding up? Does it matter if a human ever has to read the config file?
no. use toml its way better
Ooh I like your profile picture
thanks dude
nah toml is way better
JDSL will like to have a word with
{ "_": "who needs comments when you have _" }
But that feels so hack-yyyyyyy :( And what if I want to write a function that iterates over the keys to count the things they represent, or something?
Yeah I know, but the only way to get any form of comments in pure JSON is hacky workarounds, unless you use a different format which supports comments like JSONC or YAML
Eh even vscode just uses jsonc and calls it .json. At this point if your parser doesn't support it you need a better parser
There’s not a lot of parsers which support it though. For JavaScript in the browser and on node they implement the `JSON.parse()` function from the JavaScript spec which doesn’t have support for comments, and that’s what most devs will use
Not a lot != None I honestly dunno about JS since I avoid it like the plague, but I am pretty sure you can either find something or just load a file and preprocess it yourself
I stand corrected, it looks like Microsoft provides their one which I’m guessing is the same one they use for vscode, so I guess that’s a good alternative. I don’t know if that’s the case for other languages https://www.npmjs.com/package/jsonc-parser
C# built in parser supported block comments initially and added line comments in v6 Newtonsoft had them since forever and can even load them as separate special values if you want
ignore anything that starts with the underscore.
You mean JSONC, JSON5, JS, or ?
Sometimes I wish I could, just so that I could comment out something for a quick test
In many cases, you can. Many modern tools that deal with json files are okay with // comments.
Not node json imports
{ comment: this is a comment }
{ “comment”: “this is a comment” }
{ "u": "right" }
[удалено]
You win
Duck you, take your upvote and get out
Ctrl + / in code editors all the way
I rebind my editors to `Ctrl + q` so I can do it with one hand. Also, muscle memory from that being the default in SciTE, which was the first editor I used a bit over 15 years ago.
You know there are two control buttons on the keyboard right?
Yes, but left hand comments/uncomments while right hand exclusively rides the arrows or the mouse. It just feels much more ergonomic to me.
I also like to keep one hand free when I'm commenting!
Helps to keep the other hand in the arrows or mouse. But also, yes.
What's that on a European keyboard if you happen to know? Or Nordic. Whatever require / to be used with shift
That is one thing I like about the sap code editor. Commenting and uncommenting is ctrl + >
As usual vim has a quicker method but it requires 3+ keybinds to use Ctrl v to enter block mode and select all lines then shift i to enter insert mode and insert // or # or whatever, doesn't auto do html or anything like code but lets be honest nobody using vim is coding in HTML a whole bunch. Vim users probably only code in RUST or Ziggy or Brainfuck lets be honest
This is absolutely not quicker than Ctrl+/
it depends, if you want to comment all lines inside the block you can select by just pressing `vi{` that is much faster than using the mouse or shift-arrows
Im assuming the average code user reaches for his mouse goes over to the line, presses ctrl / then moves mouse away
Shift+arrows to select lines you want to comment, Ctrl+/ to comment.
> arrows If you leave home row, you've lost. Might as well jump on an office chair for a quick sword fight. Flow is broken. :-)
I thought the memes about vim users were just jokes… how wrong I was
Holy crap. This is programmer humor. I made a reference to a classic XKCD and added a smiley face. You guys are wound up pretty tight if you couldn’t see that’s tongue in cheek.
If we're talking about the average code user then vim is exactly NEVER quicker lol
Just i just press gcc in mine and done
🤓
I use vim and do web dev… and also have a plugin to do things quicker
> vim has a quicker method…requires 3+ keybindings > lets be honest > let’s be honest You contradicted yourself. Twice.
i use comment.vim or whatever its called gcc and its commented
{/\* commenting in JSX \*/}
Fuck this. > {/* WebStrom */} > {/* will */} > {/* comment each line this way */} >{/* And VsCode >Comments like this */} And Select + remove comments doesn't work.
Hmm, in IntelliJ these things are customizable. I'd be surprised if they weren't in other IDEs.
First one is objectively superior
{% comment %} commenting in Liquid {% endcomment %}
I hate HTML comment syntax. Then there's Haskell that uses -- which I have no comment on
-- is standard for SQL as well.
And Lua
COBOL is a * but only if it is in column 7. Unless you’re using that fancy free format COBOL.
> but only if it is in column 7 I always thought maybe I’d learn COBOL someday. This comment has changed my mind.
Was just thinking the same thing, what is column 7?!
The first rule of column 7 is that you don’t talk about column 7.
I mean anything that doesn't require 50 symbols and two lines to write is *okay*-ish. Comments are supposed to be quick, not good looking
fuck yeah
Commenting in JSON:
That is why JSON 2 Electric Boogalo exists, although sadly, it's named JSON5
To comment in JSON, you create another file called `comments.txt` and put it in the same directory
Thank you, that's terrifying.
'COMMENT' This is a comment in ALGOL. It is terminated by a semicolon. ; 'COMMENT' Know what else is terminated by a semicolon? Y:=X+1; 'COMMENT' Every other bloody line of logic, which means the above line of logic was never performed.;
this is heinous
I'm greyer than I should be.
Very off topic but how would one go about learning ALGOL?
I didn't ever learn ALGOL directly, but there's a large family of languages that are closely based on it. I learned one of those and worked with it for years. I learned it because it was the only implemented high level language for that system. I think the biggest ALGOL-decended language is Pascal, so I'd go for that
Neat, I was mostly interested in learning ALGOL specifically because I like learning useless things but maybe I'll learn a bit of Pascal for fun.
Luckily ie6 is ded
We have Safari now to replace it
-- commenting in SQL..
/* commenting a block in SQL */
My favourite because it works also in C. I am not really a dev but I like sql and C. Nobody cares.
Lua too
``` “”” Python is the really crazy one using string literals as comments “”” ```
; Commenting in assembly
; also used for commenting in MUMPS. for loop=1:1:10 do .;things, but don't forget, when you're in a loop, the comment goes at the number of dots you are .;at in the loop, or the loop ends right there AND the interpreter will not warn you that has happened! .quit quit
also used for ini files
*for some assemblers some assemblers take //, #, and there's probably more and some assemblers take multiple of those options
I remember my first internship at a company that had two developers and one of them saw me comment out some tag and I got told off for them being "horrible wordpress things"
It seems kinda coherent, I'll let it pass
' commenting in Visual Basic
``` -- and then there's Lua ```
finally, after all those years, someone who uses lua!
I only use it with computercraft 😭
rem Commenting in BASIC or batch files :: not really a comment in batch files, but can be used as one, and (something I read when I was a kid), its slightly faster since rem is an actual token that has to be parsed, and :: is a malformed label and is ignored. :: i'm not sure how true that is though.
Ignore the next sentence. Commenting in ChatGPT
`\\ commenting in PHP`
or # like this to annoy the purists
--what are you guys talking about
Why is this comment empty?
Is it?
is this sql?
<%--commenting in aspx--%>
REM I like to keep it BASIC.
' not visual enough.
Commenting in Brainfuck
‘ Commenting in visual basic is horrendous
20 REM COMMENTING IN BASIC
HTML comments are the most ye olde shit. Its easier to write an HTML comment in the margins of a punch card than to do it manually in a text editor.
% commenting in LaTeX
/* Fun fact /* In C */ this is not a comment */
`C Commenting in Fortran`
Not just JS. C, C++, Turbowarp, etc.
{{}}
@commenting in Razor
; commenting in assember
Wait for op to see how it was in xhtml
I'm learning Ruby on Rails right now and commenting in the HTML template files (`.erb` files) is such a pain in the ass. Sometimes you'll comment something out and it will evaluate the expression anyways. It defeats the entire purpose of a comment! Plus, there are two ways to comment - first is by using an HTML comment `` and the second way is by commenting the Ruby statements `<% #comment here %>` and both of them seem to still create bugs. There's probably something I'm missing but it's certainly not intuitive.
//that's C, C++, Golang that's right and bless
I think it is a personality defect, but I love html comment syntax. I want to use it everywhere.
Good news you can also used it in JS apparently , it was added so you can comment things about of script tag for browser who ignore them /shrug
% Commenting in Matlab
It makes sense. The `<>` represent a comment tag and the `!--` is like a shebang line...
``` {% comment %} Commenting in Liquid{% endcomment %} ```
Also I recently learned that
! don't forget commenting in Fortran
@ Commenting in ARMv6-M on GAS
Okay. Has anyone ever commented their html code other than to comment out a PHP block?
This is so stupid and annoying
{/* comment your information here */} JSX
#--dba says hello
@\* commenting in razor/blazor \*@
XML will be on HTML side 🤷♂️
{/* hello from JSX */}
rem
rem commenting in batch
<>{/* commenting in JSX */}> (sometimes it doesn't even work either)
`{# Do you even Twig? #}`
String redditComment = "Java have left the chat.";
How about commenting in different .txt file and reference the line number
--[[ Lua block comment -‐]]
Who cares? I just press "ctrl + /" andnit just works.
;; commenting in elisp
I sometimes comment in xaml, I cannot trust future me
; Commenting in ASM
Commenting in PDDL: ; comment
Just wait for language that makes the opposite to make easy write comments. You will prefix code with some character and lines without prefix will be treated as comments - multiline comments solved automatically.
And then you start using django. You use them all and then there is one more.
Fortran 77
/* in PLI */ Am I the only one coding in that language?
And xaml
-- and {- -} master race
Brainf*ck comments. Everything that isn’t valid syntax is a comment.
"Commenting in Smalltalk“
-- nice
{# comment #}
You should look at Ocaml comments
REM THIS IS COMMENT IN WINDOWS BATCH FILE
Quality humour post, feel free to post on r/leetcodecirclejerk as well for some additional karma ;)
// commenting in c#, c++, java
Rel
Sql style -- or /* xyz */
⌘/Crtl + / easy
Commenting in reddit:
/\* COMMENTS IN SKWILL \*/
% commenting in prolog
<# Powershell, for the refined gentleman coder #>
; commenting in windows CFG file
--[[ lua comments make me wanna peel off my skin --]]
Just use ctrl K + ctrl C
Why HTML doesn't have comment tags is beyond me.
Leave Your Comment