Skip to content

improve toUnix#37

Closed
jeff-hykin wants to merge 1 commit intoanodynos:masterfrom
jeff-hykin:master
Closed

improve toUnix#37
jeff-hykin wants to merge 1 commit intoanodynos:masterfrom
jeff-hykin:master

Conversation

@jeff-hykin
Copy link

@jeff-hykin jeff-hykin commented Jul 4, 2020

As a side note: its good to see someone else using coffeescript!

@anodynos
Copy link
Owner

anodynos commented Jul 6, 2020

Hey thanks for the PR - I will have a look.

Can you please provide some examples (or better tests, if not I 'll add the tests) of the current version failing to handle, where this PR is handling properly?

@anodynos
Copy link
Owner

anodynos commented Jul 6, 2020

Regarding coffeescript, I wrote this lib when coffeescript was popular and I was all over it then.
I will consider converting the main code to TypeScript at some point :-)

@jeff-hykin
Copy link
Author

jeff-hykin commented Jul 7, 2020

I will consider converting the main code to TypeScript at some point :-)

Oh please do not 😣 . Typescript is the embodiment of coffeescript's antonym: additional bulky syntax instead of less, not 1-to-1, impure, and slow.

Can you please provide some examples

An example would be
\\?\C:\this\can\be\a\really\really\really\really\really\really\really\really\really\really\really\long\path
(see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation)

I've never actually run into this in the wild. I found it looking at the npm slash package (e.g. function) which does something similar to toUnix and had code related to the \\?\.

Sorry I can't write the tests too ¯\_(ツ)_/¯ I've got too many repos as well

@anodynos
Copy link
Owner

Sorry, I've been a bit ill and away from things!
Thanks, I will check it out and write some failing-&-then-passing tests, and then I'll hopefully merge this PR :-)

Regarding TypeScript, you got it on the wrong foot. Sure, its a bit more verbose, but the benefits are so great and outweigh that!

It gives meaning to your code, it is self-documenting it, creating abstractions that would be very hard otherwise. And above all, types are optional!

I loved CoffeeScript, and I still think it was awesome (like 9-out-of-10 syntactic improvements of ES6 were borrowed from CS, and still not even half made it through) but I feel I can't write JS anymore! It sucks not to have clear interfaces, validations, compile time checks. As for slowness, do you mean at compile time? Cause that usually takes just a few milisecs while developing in incremental watch mode... Give TS another chance, it's awesome! And the best thing Microsoft has ever built!

@jeff-hykin
Copy link
Author

jeff-hykin commented Jul 15, 2020

Good to hear the update!

And oh, much to my dismay, I end up having to give Typescript another chance every week. Its just JavaScript with Training Wheels and ChildLock.

  • Types are not optional: pasting JavaScript into Typescript will throw errors. You have to type everything, at least implicitly, or as any

  • The code completion is no better than jsdoc, it's not "self" documenting: it's mandatory documentation, great for devs who don't voluntarily use jsdoc. More than that, if my function needs an odd number, type safety doesn't help explain or ensure that. There's no shortcut for documentation

  • It complains nonstop about problems that can't exist, such as that ("").match(/\s*/) "could" return null despite that, being a zero-length regex, it will always match something and return a match object. I know my code better than the Typescript compiler, and it gets in my way more than it helps. When I want validation I write unit tests that are better than any type safety.

  • If ugly angle brackets and literally useless declarations like any don't take up enough room, the mandatory if statements covering impossible situations surely do.

  • I don't care about compile time: The runtime performance is strictly less than JavaScript. It literally can't ever beat JavaScript because it compiles to JavaScript. However it can always do worse than JavaScript because of the wrappers and additional logic required for things like enums and interfaces. CoffeeScript is 1-to-1 so there's no loss.

Typescript has no interest in increasing code readability with something like and instead of &&, and I'll take code clarity over compiler errors any day.

@anodynos
Copy link
Owner

anodynos commented Oct 6, 2020

Hey @jeff-hykin, I'm closing this PR cause I think it was covered well enough with #38

Regarding TypeScript, I'm sorry you feel this way, maybe getting used to it will change your mind. Have you tried NestJS? It rocks! I used to love CoffeeScript's clean syntax and the only reason I don't advocate coffeescript@2.x anymore is the lack of types ;-)

@anodynos anodynos closed this Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants