Hacker Newsnew | past | comments | ask | show | jobs | submit | ginko's commentslogin

Adding significant whitespace to a new language feels like a bad choice. It's not terrible but I do think it was a bad call for Python in hindsight.

At least here they provide an alternative syntax that does not need significant indentation, so a program structure may be written on a single line.

Massive fail. I dread having to move code around my F# codebase.

why do you think it was a bad choice?

It‘s a source of problems with mismatched tabs/spaces being used for indentation between team members for fairly little upside. Imo it also makes moving blocks of code more cumbersome.

Shrubbery, Rhombus's first-pass indentation-sensitive syntax, has a syntax form to facilitate copy-paste.

With guillemets, « and », you can make a section of Shrubbery code indentation-insensitive. The idea for copy-paste it to "armor" the section you want to copy with guillemets in the right places, and unarmoring it after posting.

This needs editor support to do fluidly, but imo it's much better than trying to copy-paste the indentation-sensitive syntax.

The Guillemets syntax is described here: <https://docs.racket-lang.org/shrubbery/group-and-block.html#...>

I can't tell from my 5 minutes of poking DrRacket whether it supports this "armoring", I've been writing Shrubbery in nvim, which, unsurprisingly, does not support it.


In DrRacket mark the section (with shift+arrows) then use tab or shift+tab.

That's horrifying.

At least it shows that the authors are aware of this issue and planned for it.

Any language with significant indentation ends up specifying "Indent with spaces, not tab characters" for just that reason. As I recall, Python had that as a recommendation while F# ended up with it as a requirement, but it's been a while since I looked at that so I could be wrong. But in my experience, the category "people who complain about significant whitespace" is nearly a subset of the category "people who prefer tabs over spaces for indentation".

(Moving blocks of code around is not a real problem if your editor is capable of easily highlighting the thing that was just pasted. Because then you just hit that key binding, then press `>` or `<` — or Tab/Shift+Tab if you are using an inferior editor ;-) — until the indentation is where you need it. I haven't found it to be a big problem in practice when writing Python, though mileage will likely vary).


For me, the alternative solution makes much more sense for a language with significant indentation, i.e. to use only tabs for indentation and to completely prohibit spaces before the first printable character of a line.

I do not know why I have never seen this solution in practice.


It depends on the language's indentation requirements. That can work in Python, where you never need to line things up with characters above that aren't a multiple of an indent level. But in F#, at least a few years ago when I tried it, there are times when you would need (or strongly want) to line things up with other characters. For example, this example from https://learn.microsoft.com/en-us/dotnet/fsharp/style-guide/...:

    functionName
        arg1
        arg2
        arg3
        (function
         | Choice1of2 x -> 1
         | Choice2of2 y -> 2)
Note how the | needs one extra space in order to line up with the word "function", due to the open parenthesis. If you're using tabs for indentation, that means you need a series of tabs plus one trailing space after the tabs, in order to line up the | correctly.

Any situation where you must have a mixture of tabs and spaces for code to work right leads to a nightmare. Because it makes you have to turn on visible whitespace in your editor and peer closely at the lines. I have a simple rule: "Do NOT make me care whether there are tabs or spaces in this file!" If it's significant whether a line is indented with a tab or space, then that rule is broken, and you're probably in for a bad time. (Case in point: Makefile syntax).


I did not take this in consideration, because for such code, with brackets and separators, I prefer to align the separators with the opening and closing brackets, like this:

  ( ...
  | ...
  | ...
  | ...
  )
or

  { ...
  ; ...
  ; ...
  ; ...
  }

I just checked, and lining up the | with the open parentheses does work in modern F#. I believe they revamped the indentation rules a few years back, because I definitely remember things like that not working back when. So perhaps now your idea would be feasible. However, there was definitely a time in the past when F#'s indentation rules would have been problematic for tabs, and that fact is why the F# compiler still forbids tab characters outside of string literals or comments. (And there are still indentation styles recommended, though not required, by the official F# style guidelines that would require the use of spaces. Which is another reason to avoid tabs in F# code, because they're less flexible than spaces. Usually the reason to prefer tabs is because they're more flexible, but the slightly-peculiar nature of F#'s indentation rules means tabs are less flexible in F# code.)

>Because then you just hit that key binding, then press `>` or `<` — or Tab/Shift+Tab if you are using an inferior editor ;-) — until the indentation is where you need it.

But that's cumbersome compared to moving the block of code and hitting Tab to have your superior editor immediately indent the block at the right level.


That's why you use an autoformatter.

IMO the biggest downside is that it gets awkward to do closures and inline expressions and things like that. For example Python's `lambda` and if-else expression which are super weird and special snowflakey compared to the equivalents in e.g. Rust or OCaml or even Tcl.

Maybe there's a way to do it nicely; I haven't thought about it too much.


You can't autoformat broken indentation with significant whitespace since it would make the program not parse (or parse incorrectly)

I was responding to

> mismatched tabs/spaces being used for indentation between team members


Well yes. Say you check out a project that's all tabs but your editor is using spaces for indentation. You change a line and now the program is broken. Calling the auto-formatter won't help you.

This is literally not a problem. All Python projects use 4-space indentation. You would not have your editor configured for tabs when editing a Python program.

It's really not an issue at all in practice. The issue of making moving code more awkward is true but really barely an inconvenience. It's not difficult to select it and press tab a couple of times.

As I said the biggest issue is with closures and expressions that you might want on one line.


>This is literally not a problem. All Python projects use 4-space indentation.

Tell that to the one team at my old workplace that used spaces for all their scripts.

Like I said it’s a stupid source of errors that can be mitigated through style guides and tooling but it’s still a source of errors.


Probably way faster as well.

Seems like only the Spanish Wikipedia mentions this which is suspect. English Wikipedia mentions German&French manufacturers in the 1890s. German Wikipedia attributes it to a French Citroën engineer.

Being able to hear your surroundings on a motorcycle or bicycle seems very important for safety to me. Filtering that out feels dangerous.

In the Netherlands they banned wearing earplugs/headphones on bicycles for this reason (as well as using your device). Whether that's enforced / enforceable is another matter though.

On a motorcycle you need hearing protection due to wind noise, but good plugs will filter out the louder noises, not so much important ones.


On a pedal bike, it's very important because you are most likely to be hit by cars from behind. Motorcycles move much faster, and most riders wear helmets as well, already impacting hearing. The road noise and wind is very loud, try rolling down the window in a car on the freeway and imagine that on .your whole body.

Had a close call with a cyclist going the same direction as me. She veered over in my direction as I was overtaking and was rather startled to see me, as she was wearing Airpods.

Ah yes, the unintentionally suicidal, scariest part of being on the road.

> On a pedal bike, it's very important because you are most likely to be hit by cars from behind.

If anyone hasn’t tried a bike radar, they are a massive help. Eg Garmin Varia. Take care with the new model, the light is insane, on 5% you have the eye of Sauron blinding the rider behind you.


>you are most likely to be hit by cars from behind

Do you have a source for this info? It contradicts what I've read about the subject.


Just personal and anecdotal experience, and also that bike lanes usually move with traffic rather than against it.

As a cyclist, I find sound such a poor signal I'd consider it optional. Too many threats are silent and sound is too late, misleadingly bounces of other surfaces and generally poorly correlated with significance.

Safe cycling is all about vision. If you can't see it's safe, it's not. It isn't simply seeing imminent threats but predicting them e.g. identifying drivers that aren't paying attention and where a car could suddenly emerge like blind turnings, car doors, pedestrians and such, and countering with appropriate caution / road position.

If you find noise useful, IMHO it means you aren't sufficiently aware of your environment.


I cycle every day, and sound is definitely important; you need to plan ahead when you hear an ambulance approaching, for example. Plus, your brain processes things you see much better if there's a sound it can correlate the movement with.

There is practically nothing to hear that matters for your safety on a motorcycle at highway speeds. An ambulance you will hear even with headphones.

Ear plugs are recommended while riding a motorcycle.

Wasn't that what the whole Alphabet re-org was supposed to do?

Alphabet has Google with 99% of the profit through Ads, Search, Cloud, Gmail, Youtube etc

and tens of losing companies that make balloons or whatnot


I'm generally in agreement on social media bans for children, but the proposed solution is age verification on all platforms which has a huge amount of problems.

Why can't we just ban the use of smartphones without parental locks for under 16-year-olds instead? That's not perfect but would already be a huge improvement and adults wouldn't be affected by it.


The key part being "feature film". There's tons of animated short films from the 1910s.


Someone prepare a set of floppy disk images so you can get the proper installation experience.


Including the mandatory corruption on the last one.


The EC wrote the DMA. There is nothing to "interpret" for them.


My Brother in Christ, different administrations can and do "interpret" laws differently all the time. Sometimes even the same administration might change how they enforce a law.

Also, technically didn't the EU Parliament write and pass the DMA, and the EC enforces it? I'm not European so I don't know the intricate details of the incredibly Byzantine process of the EU so maybe I'm wrong there


I'm from Vienna (admittedly younger) but it seems believable. The place she picks up the drugs in the comic is "Café Camera" which is clearly a reference to "Camera Club" which was well-known for this in the 80s and 90s.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: