41
10Dev
3y

Unpopular dev opinion:

I like ending lines of code with semicolons. It helps add structure and organization. My code feels naked without them. After learning to code in JavaScript and Java, it's force of habit to put them, and python's lack of them is one of the reasons I hate it's syntax

Maybe I'm old fashioned. All the hipster languages either make semicolons optional or usually actively discourage them

Idk I like them though

Comments
  • 13
    Hooray for this! Python's whitespace structuring is prone to error.

    Semicolons and curly braces. These explicit visual cues for structure allows the code to be flexibly written and still be readable.
  • 5
    Yeah, I tend to agree that brackets are a better block delimiter than just indentation. Semicolons... Not needed really, when they are 99% of time at the end of a line, so effectively "/r/n" sequence is identical to a semicolon.
  • 0
    I keep telling people.

    We use parenthesis for passing arguments, curly brackets for dictionaries in some languages, and other pairs for other things.

    And if we use ":" colons to open scopes, why shouldnt we use semicolons to *close* scopes?

    Saves the debate between whitespace vs brackets, and saves brackets for use representing dictionaries as people are used to.
  • 1
    You can add semicolons in Python, it is not needed but also not forbidden.
  • 1
    @Wisecrack most programming languages are context dependent grammars. The same symbol can mean different thing depending on context, so brackets can be both for dictionaries and block scopes
  • 3
    i've been saying it from the start, and i'll keep saying it till the end because it keeps being true:

    using an invisible character as a nesting symbol in a text which switches between multiple nesting levels all the time is a GeNiUs idea, since it's so easy at a glance to count how many invisible characters are there in a row on the start of the line.

    right? RIGHT?! gEnIuS!
  • 1
    I don't mind eitherway.

    I write my code so I can read it back at a glance no matter the language.

    even if I agree that using indents is a bit heavier on mental complexity when reading back, my solution to that is using proper package management... if you have your code organized into readable blocks/files it eliminates the issue...

    when it comes to python syntax, more than missing brackets or semicolons, I'm more annoyed by writing code comments *inside* the function body using multiline strings """ """.. That kinda throws me off as I like my function/class comments to be above the body like with Javadocs.

    eitherway, I enjoy both the language and it's ecosystem a lot.

    I should get into rust too, that looks like fun
  • 3
    Some of my oldest buddies in here will prolly remember me saying at one point in time that i fucking hate whitespace sensitive syntax.....I use Python and generally like Python, but whitespace sensitivity ruins the fucking language for me.

    Another one I have been experimenting with is Nim, nim is an otherwise greatly implemented and interesting language......but it lacks semicolons and it uses whitespace as block delimiting......It....rubs me the wrong way.

    Would you be willing to compromise on having {} but not ;'s? In that case, Scala might be just for you. Using Mill and Ammonite I have been able to port some of my Python code into a platform with an actual proper type system, the entire powerhouse of libraries available to the JVM ecosystem AND the facility of a good repl with a pretty cool syntax.

    "thErE sHoulD bE oNe anD preFFeraBly onE waY to Do thIngs" <--- I get it, Guido was left scarred from Perl, but fuck man I don't like whitespace
  • 0
    @inawhile tried using comma instead of semicolon?
  • 0
    @Midnight-shcode that's Go

    Also Go is the reason why I disagree with that statement don't miss them at all while in python I really have to make the switch. Not using ";" in JS is dangerous so I do put them in although when working on a Go project I tend to forget them. Switching to python is a rather large context switch and that fucks me up from time to time.
  • 0
    It depends on the language. Python is designed in such a way that if you don't put a line break at a stupid position (eg. before the parens in a call) it's unambiguous.
    In Javascript on the other hand,

    const foo = bar;
    [baz] = bazv;

    is fully legal and perfectly sensible array destructuring, but without semicolons it translates to

    const foo = bar[baz] = bazv;
  • 0
    If your language doesn't separate statements, you have to ensure that no legal statement can be broken up to two legal statements with a line break, or that such positions are objectively bad places for a line break _and_ that the parser only reads two lines together if they don't make sense separately.
  • 0
    @inawhile I agree, but when someone does it however the fuck they want but it doesn't follow a good Standart I get triggered.
Add Comment