Live data from Hacker News

Why I develop on Windows

blog.shortround.dev

141–150 of 187 posts

Re: Why I develop on Windows

#141
post #74

Earlier quoted context omitted.

100% and I never thought of that before but I can see how you'd get that impression from tutorials. The VSCode powershell extensions will also give you suggestion squigglies under all of your aliases in a saved script if they're not long-form, but I usually mix and match based on pragmatism. My use of alias vs long-form usually comes down to two sort of situations: * Ad-hoc at the shell: all aliases all the time (and…

Regarding not thinking of them as acronyms: yeah I get that. I was wondering how to best phrase that sentence because, indeed, curl also does not stand for C Uniform Resource Locator in my head, or grep for global regular expression perl-style (if I'm remembering that one correctly). It's just curl and grep. However, whereas curl and grep are really treated as names, spps I can currently regurgitate only by thinking…

totally agree, and yeah, "you eventually memorize all the arcane bits" definitely isn't a point in favor of powershell

there are also some commands I use all the time that don't have built in aliases like the json converters, so that makes cross-machine alias consistency for some important things not great

Re: Why I develop on Windows

#142

Earlier quoted context omitted.

It's just a knee-jerk reaction people have in any thread where powershell is mentioned. "Hur hur long command names." Doesn't bring anything to the discussion.

It doesn't bring anything new to the discussion, but if it is the reason people don't use it, then it is relevant. I don't use it, because I was Mac/Linux at home and Linux at work for so long - only now do I have a reason to.

I think that's important, tbh

I love powerful. I've used it for a long and even though I primarily work on macos/linux now, I install powershell core on everything.

That said, I _started_ using it because I was working on a windows box doing C# and managing windows servers.

There's just not a compelling reason for a dev to learn it outside of personal interest, and I think that's a completely legit mindset, since we all have limited time. I'm even fine with misconceptions--we all have them about something--as long as the person is being a decent human about it (which is why I've enjoyed this thread/comments)

Re: Why I develop on Windows

#143
post #10

> I know a lot of developers who will opt to do all of their scripting in python these days, even putting #!/bin/python3 at the head of a script so that it runs through the shell. ...which is exactly what you're meant to do. This is not an example of how bad Bash it, it shows that you didn't understand what Bash is. It's expected to use various languages to write code on Linux, nobody wants you to do things in a lang…

> even putting #!/bin/python3 at the head of a script so that it runs through the shell. It's not the shell, it's the kernel that interprets the so-called shebang. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... Edit: oops, should have previewed, cryptonector beat me to it.

Yep, imagine how things would be like if the kernel didn't understand shebangs. exec() calls would fail for non-ELF executables and we'd be devising all sorts of ridiculous workarounds. We're lucky that didn't happen.

Re: Why I develop on Windows

#144

Earlier quoted context omitted.

> > even putting #!/bin/python3 at the head of a script so that it runs through the shell. Uh, not, in that case the shell is not involved at all. The kernel implements shebang and will automatically start the interpreter, whatever it is, without having to go through the shell.

so, a typical noob. Even though he claims he shined in the operating systems course.

My son shined in that course, but I'd be surprised if he knew this particular bit of trivia.

Re: Why I develop on Windows

#145

Earlier quoted context omitted.

> even putting #!/bin/python3 at the head of a script so that it runs through the shell. It's not the shell, it's the kernel that interprets the so-called shebang. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... Edit: oops, should have previewed, cryptonector beat me to it.

Yep, imagine how things would be like if the kernel didn't understand shebangs. exec() calls would fail for non-ELF executables and we'd be devising all sorts of ridiculous workarounds. We're lucky that didn't happen.

> Yep, imagine how things would be like if the kernel didn't understand shebangs. exec() calls would fail for non-ELF executables and we'd be devising all sorts of ridiculous workarounds. We're lucky that didn't happen.

Actually, that did happen. Quoting https://utcc.utoronto.ca/~cks/space/blog/unix/ExecAndShebang...

"In V7 (and versions before it), the exec*() family of system calls only worked on actual binary executables. In order to make shell scripts more or less work, the shell (and I think perhaps some other programs) reacted to an ENOEXEC error by assuming the executable was actually a shell script."

And yes, the ridiculous workaround (treating the file as a shell script when it's not an executable) seems to still exist to this day.

Re: Why I develop on Windows

#146

Earlier quoted context omitted.

I am also miserable when speaking chinese. But I have no dobut that to people who actually speak chinese, it isn't gibberish.

This isn't really an argument against what I said. You can pick and choose your shell language based on preference for syntax. You generally learn a human language because you have to for one reason or another. I think bash has an unintuitive syntax, and I think powershell's is more readable

If languages were intuitive, it wouldn't take years to learn them.

Re: Why I develop on Windows

#147

Earlier quoted context omitted.

Only if you use osx… on linux there is no need to do such a strange thing.

Right, because Linux users are famously content to accept OS defaults and have no interest in tool selection or customizing their setup. /s

Hahahahaha.

Now show me a linux distribution where what you are saying is true.

Re: Why I develop on Windows

#148
A lot of praise for the "little known" (???) Path variable in windows. But dealing with windows path really sucks for one major reason: there's a shockingly low character limit [0]

Also idk if this is a problem for anyone else, but since admin privs are required to add to path, I need to fetch IT every time I need to add to it on my work machine, lol.

[0] https://superuser.com/questions/1385854/how-do-i-bypass-rest...

Re: Why I develop on Windows

#149

Earlier quoted context omitted.

It is true. https://stackoverflow.com/questions/40794287/cannot-write-to... https://www.howtogeek.com/wp-content/uploads/2018/11/img_5be...

Look, I just created a file named "aux.rs" on my Windows machine. It's not true.

Same. It's definitely not true

Re: Why I develop on Windows

#150

Earlier quoted context omitted.

I'm still a PowerShell novice, but I believe ForEach-Object and ForEach are subtly different, and PowerShell has classic For(Init; Condition; Increment) loops also but it's even more different than those two.

ForEach-Object and ForEach are the same thing. Get-Help ForEach-Object ... ALIASES foreach %

I have seen that, and that's partially why it seemed so confusing to me but at least one difference is

  The ForEach-Object cmdlet works much like the Foreach statement, except that you can't pipe input to a Foreach statement. For more information about the Foreach statement, see about_Foreach.
https://learn.microsoft.com/en-us/powershell/module/microsof...

And another appears to be performance

  PS /home/me> $time = (Measure-Command {
  >>     1..1E4 | ForEach-Object {
  >>         $_
  >>     }
  >> }).TotalMilliseconds
  PS /home/me>  [pscustomobject]@{
  >>     Type = 'ForEach-Object'
  >>     Time_ms = $Time
  >>  }
  Type           Time_ms
  ----           -------
  ForEach-Object 144.558



  PS /home/me> $Time = (Measure-Command {
  >>     ForEach ($i in (1..1E4)) {
  >>         $i
  >>     }
  >> }).TotalMilliseconds
  PS /home/me>   [pscustomobject]@{
  >>     Type = 'ForEach_Statement'
  >>     Time_ms = $Time
  >>  }
  Type              Time_ms
  ----              -------
  ForEach_Statement  17.621
https://devblogs.microsoft.com/scripting/getting-to-know-for...
Post reply on HN