Conversation started May 15, 2021 at 22:53.
May 15, 2021 22:53
CMQ: In curly brace languages, should braces be on the same line or the line below (or on the same line sometimes and on a separate line at other times)?
Same line
I used to be of the line below way of thinking but I've now learned better.
Why? (I agree, just asking for reasons)
It looks much neater
And code folding looks better too
Wzl
Wzl
May 15, 2021 22:54
@user depends :)
CMQ: Curly braces, significant whitespace, or something else?
Huh, I actually find the C# way with new lines for braces nicer
Wzl
Wzl
@RedwolfPrograms something else
@RedwolfPrograms Booth
@RedwolfPrograms bold of you to assume I have more than one line of code :p
May 15, 2021 22:55
@user go away :p
@user Sam line
Wzl
Wzl
@user like this:
@Wzl What would you suggest (same line for control flow, separate ine for functions)?
@RedwolfPrograms I'm dead serious
@Ausername May I ask why?
separat eline
@user you're not dead serious, you're user.
May 15, 2021 22:56
@user Idk, I think it looks better.
Wzl
Wzl
if (condition)
{ const smt = a;
  const smtelse = b;
  return expr }
@Ausername I'm having trouble with this keyboard, okay?
@user because the line is owned by sam
@Wzl Oh god
Besides, different line just takes up extra space
May 15, 2021 22:56
Jo King is lucky, they're the only one resistant to "You're not joking, you're ..." comments
@Ausername you're lucky that Sam manages your lines
Wzl
Wzl
@user or:
@Ausername Makes sense
@lyxal Typo
@Wzl Please don't let loose any more of that formatting here
May 15, 2021 22:57
@user You're not having trouble with this keyboard, okay?, you're user.
Wzl
Wzl
if (condition)
{ const ...
; const ...
; return expr
}
Oh no
That's awful
@Ausername Actually, that's my real name (I was named "Original Original Original VI" when I was born, but I changed my name yesterday)
@Ausername that's the joke :p
@Wzl I saw you do your SML that way, and man is that ugly
It's slightly more understandable with commas, but still
Wzl
Wzl
May 15, 2021 22:58
grins
But actually, if people had started out doing it your way, I would've found the way I do it now repulsive
if(condi
tio
n){cons
t ..
.; c
onst .
..; ret
urn
e
x
p
r
}
Wzl
Wzl
it's my protest against languages other than scheme/lisp
I hate how subjective humans are
@Wzl (Sorry, (I (couldn't (hear (you (through (the (parentheses))))))))
@Ausername I've changed my mind, Wzl's method is beautiful compared to this
if (condition){stuff; moreStuff; joeMama; return 69;}
That is the superior way
No newlines
Just one line
May 15, 2021 23:01
Not JoeMama, a rickroll link.
@user I know, right!
Wzl
Wzl
but in all seriousness, I hate curly braces and indentation because I hate statements. The only time you need (;) or (,) is statements and tuples/lists in SML
What's the alternative to statements?
Expressions
Wzl
Wzl
expressions, recursion, and parameter passing
Ninja'd
1/3
May 15, 2021 23:02
I like how Rust does it
Wzl
Wzl
the implicit return?
You can write code as if things are statements, but things like if/else are actually expressions
Implicit return is gross, not that part
Wzl
Wzl
yeah ruby did a surprisingly large amount right, minus newlines and keywords
@RedwolfPrograms Why is it gross?
May 15, 2021 23:04
What is this, TI-BASIC? Should I use the Ans variable to get the result? :p
@user How is that not one of Java's many SyntaxErrors
@RedwolfPrograms To me, val foo = if (something) { return x } else { return y } just looks awkward
@Ausername It's a label
Try it in JS and C too
@user What on earth is that
Wzl
Wzl
having return at all is gross. I disagree with trailing semicolons meaning anything though
Why is there both return and val foo =
Is this a function or not
May 15, 2021 23:05
@Ausername The stuff after // is a comment, that's ignored. The statement System.out.println is considered has the label https
@RedwolfPrograms That's what I was saying, it looks gross
@user Oh.
@RedwolfPrograms val foo = if (something) x else y makes much more sense
But...yeah. I agree with that.
"Implicit return" or whatever it's called makes sense
You shouldn't need to return from an if/else statement
May 15, 2021 23:06
val foo = something ? x : y
What were you talking about, then?
def foo(bar: Int) = {
  //some computations
  baz(bar, food)
}
What about that is gross?
Wzl
Wzl
@user line comments are gross :)
Idk, maybe just lots of time using JS _/(.-.)\_
May 15, 2021 23:08
What is that emoticon?
Upside down shrugging
lol
Wzl
Wzl
@user I see you used my indent style :(
@Wzl Lisp has line comments
Wzl
Wzl
so I'm fixing that
lisp made other mistakes like string escapes too
May 15, 2021 23:09
@Wzl I think I need therapy now
@Wzl What's wrong with escapes? They're very useful. Allowiong raw literals in addition to that is important, though
String escapes are bad now?!
Wzl
Wzl
(actually I'm considering abandoning all string literals because they cause problems)
@RedwolfPrograms YES
How???
@Wzl "Actually, I'm considering abandoning all food because it causes problems" :P
"Allowing my interpreter to run arbitrary code is causing issues"
Wzl
Wzl
@user say you make a new regex flavor that supports one extra character class like \w, now you have to use double backslashes or, slightly better, use a different escape character too, which you now have to double to include verbatim
May 15, 2021 23:12
@Wzl This is why you also allow raw string literals
Wzl
Wzl
whereas with APL/smalltalk/SQL literals you can just have a function that does escaping
So "foo\"\nbar" for normal stuff, and raw"foo\w\n" for regex and stuff
What if you want the string "'
@Wzl I find that extremely annoying
Wzl
Wzl
May 15, 2021 23:13
@user yes, except for
Wzl
Wzl
@user and I find backslashes annoying
How do those cause problems?
@Wzl Use another character, then
Wzl
Wzl
@RedwolfPrograms they remove greppability and the ability to parse (easily) with regex
I find people annoying. That doesn't mean I'm going to eliminate them all
May 15, 2021 23:14
@Wzl So you're moving the burden onto the user instead of the interpreter
@Wzl Parsing with regex isn't an important thing
That's not good design
Wzl
Wzl
@RedwolfPrograms that's why I'm still thinking about it.
Any moderately complex language probably can't be parsed with regex, that's not what it was made for
It was designed explicitly for HTML
Wzl
Wzl
May 15, 2021 23:15
but with raw literals and a regex function, it's moveing the burden to the standard library, not the user
If you really want to make parsing easier, make regex better. Maybe mix it with BNF
Wzl
Wzl
@user I hate moderately complex languages btw
@RedwolfPrograms I can't tell if you're joking you were making a joke
@Wzl I can't tell if you were making a joke either
Wzl
Wzl
@user regexes are already not regular expressions anymore, but i do think grammars are important, in a library
@Wzl The user still has to deal with annoying stdlib functions instead of having native support
May 15, 2021 23:17
I like my regexp like thing where you could use (name:abc.+) to define things for recursion
Wzl
Wzl
@user I'm laughing at myself, but I'm not joking
A language's syntax should be designed to be easy to use and understand. That does mean it should be simple, but not that you can validate/match it with a regex flavor
And there's a balance between simple to interpret and simple to write
Wzl
Wzl
@user you have to use functions to use regex anyway (outside of perl). So replace and match automatically convert to regex. simple.
May 15, 2021 23:19
Brainfuck is pretty simple, but not to use
Wzl
Wzl
@user debatable :P
Even if you have a grammar that regex could be used on, why use it when you could parse it properly? (maybe tokenize it first)
@Wzl Simple for the implementor (hau two spel?), not the user
@Wzl Everything's debatable if you're brave enough
JS has regexp literals, maybe we should all just write languages with those :p
Wzl
Wzl
@user '.*' match is not any harder than .match(/.*/)
CMP: Who thinks all syntaxes (syntices??) should be made as complex as possible so that Wzl gets annoyed? :P
3
@Wzl Okay?
It looks simpler, but I don't see how that helps your point
Wzl
Wzl
May 15, 2021 23:21
that's the syntax I'm proposing
Oh ok
What about regexes with \b and friends?
Still don't see how this is easier for people, though
^^
Or with ' in them?
You're always going to have to use some form of escape characters, unless you decide to do 'foo' + chr(32) + 'bar' to represent the string foo'bar (no idea what the ASCII actually is :) )
Wzl
Wzl
May 15, 2021 23:24
@RedwolfPrograms '/\b''' match versus .match(/\/\b'/)
So '' for a '? That's still escaping.
Wzl
Wzl
yes, but without taking any more characters, or hardcoding any shortcuts
Plus I'd argue \' is more readable
It's just a very limited, very annoying form of escaping
May 15, 2021 23:25
And using \ makes adding things like \n convenient
I'm getting too involved in this debate, so I'm going to leave now. o/
Wzl
Wzl
@RedwolfPrograms newline is more readable :)
 
Conversation ended May 15, 2021 at 23:25.