[HN Gopher] WelsonJS: Build a Windows app on the Windows built-i...
       ___________________________________________________________________
        
       WelsonJS: Build a Windows app on the Windows built-in JavaScript
       engine
        
       Author : hcho3
       Score  : 36 points
       Date   : 2024-08-22 04:20 UTC (12 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | rvnx wrote:
       | Quite amazing solution. From the .hta file you can see it was
       | inspired by VBScript (whose most popular software is ILOVEYOU I
       | guess).
       | 
       | It looks like the ultimate hack, but why not ? It's very creative
       | and the intention is good as well: TypeScript/JavaScript is a
       | very popular language. Though C#.NET is great as well.
       | 
       | It could make sense in the very long-term that Microsoft
       | themselves explore this possibility.
       | 
       | Ultimately "TypeScript.NET or JavaScript.NET"
        
         | h335ian wrote:
         | This stuff pre-dates .NET and quite honestly I think that's
         | what m$ was going for in those early days. VBScript was pretty
         | annoying and dealing with COM objects sucked badly. Back in the
         | day we'd build in a local VB interop with JavaScript so we
         | could make system calls and interact with native Windows
         | stuffs. This predates JSON so at the time we'd use XmlHttpRpc
         | to talk to remote/hosted services.
         | 
         | I'll double down on the urge to drop TypeScript. That pile of
         | nonsense came from the classic OOP folks - "But where are my
         | TYPEs!? How do I know what type that variable is!?" (first the
         | Java/C++ folks then the .NET folks "solved" the brain fuzz
         | around functional programming and dynamic types by giving you
         | TypeScript)
         | 
         | Having been out of the m$ ecosystem for some time, I'm kinda
         | surprised HTAs are still around, I'm guessing to avoid breaking
         | things. Once .NET started taking off - I always assumed that
         | would replace the VBScript side of things and let you build
         | proper, elegant system interfaces for your JavaScript app. I
         | really imagined the goal was to drop Windows forms/object
         | controls - but I always imagined BATTLES at m$ over being able
         | to create Windows "apps" that didn't conform to native UI
         | controls, couldn't be controlled through Windows theming
         | engines, etc. kinduva brand control battle. I always imagined
         | some team going "NOOO, just build a web app, you're breaking
         | all the UI rules!!!"
        
           | mynameisvlad wrote:
           | > "But where are my TYPEs!? How do I know what type that
           | variable is!?"
           | 
           | Someone _clearly_ hasn't worked in any sort of sizable code
           | base. Come back when you are writing something spanning
           | hundreds of JS files and where it takes you three times the
           | time to verify that any small change isn't a typo or wrong
           | type off from a runtime error. TS _heavily_ speeds up the
           | development cycle by bringing an entire class of errors from
           | runtime to compile time and that has _nothing_ to do with OO
           | and inheritance.
           | 
           | Simply put, TS is an infinitely better and safer language to
           | develop in and it took the web world by storm _for a reason_.
           | People didn't decide to switch en masse for shits and giggles
           | and you should realize that just because you have a different
           | view does not mean that everyone else around you is wrong.
           | 
           | > m$
           | 
           | Seriously? It's 2024, and we're all adults. This does nothing
           | but water down your point.
        
         | karpour wrote:
         | Look up WinJS sometime! It was a really neat idea that MS sadly
         | abandoned.
        
           | h335ian wrote:
           | +1 - that was a really cool idea that I really was hopeful
           | would take off.
        
       | h335ian wrote:
       | Been doing this since 1999. The only thing novel I see here is
       | the transpilers - but you know... you don't need that. You can
       | build HTAs with native JavaScript, CSS and HTML - and with a
       | little VBScript mixin, directly work with Windows libs. Back in
       | '99 and early 00's I was delivering "thin-client" control panels
       | & management tools for server farms, sensitive accounting data,
       | among a variety of other things. It was (and likely still is) a
       | great way to provide a web interface as a desktop app for
       | scenarios where exposing the management interface to the open web
       | is undesirable.
       | 
       | Nifty project, but IMHO the world is better off using native
       | JavaScript without all the BS that comes with TypeScript, etc.
       | JavaScript is so powerful and amazing, it's a bummer to hamstring
       | your app by using TypeScript and classic OO inheritance models
       | that preclude the beauty and dynamics of JavaScript as a
       | functional, prototypal language.
        
         | nsonha wrote:
         | > using native JavaScript without all the BS that comes with
         | TypeScript
         | 
         | do you think javascript was just too easy and people had to
         | invent some bs to make it more interesting for no reason? You
         | don't even know what you're talking about when you make the
         | connection from ts to oop.
         | 
         | My experience comming into javascript is that it's a garbage
         | language and the web stack was a joke, everything was hard for
         | the wrong reason (css centering things kinda stuff)
         | 
         | All these modern tooling, though complicated, is not new in
         | NORMAL programming and makes sense, so you cow boys learn to
         | deal with it.
        
           | h335ian wrote:
           | I think, based on many battles, a lot of folks in the early
           | days that came from Java/C++ absolutely struggled with the
           | key concepts of JavaScript, couldn't find "features" (like
           | strong typing) they claimed were critical for writing good
           | software and invented ways to make the language fit their
           | paradigm, rather than really deep dive into the language and
           | embrace it. There were constant battles back then - and I'm
           | sure the battles continue.
           | 
           | JS was certainly never a "garbage" language but the elegance
           | is unappealing/unappreciated by entire classes of developers.
           | I totally get the perspective, but it's all based on a
           | worldview that just doesn't get functional programming
        
             | dleeftink wrote:
             | I hear you, but am also interested in some JS libraries or
             | techniques that fall in the elegant category.
             | 
             | An elegant typed one would be Structurae [0].
             | 
             | I imagine/would love to see a bunch of elegant non-typed
             | ones as well.
             | 
             | [0]: https://github.com/zandaqo/structurae
        
             | danmur wrote:
             | I love functional languages but I'm not sure how JavaScript
             | could be considered as a functional language (at least if
             | functional means something like haskell, or elm).
             | Functions-as-values isn't enough, otherwise Python could be
             | called a functional language.
        
               | h335ian wrote:
               | Classic example of comments I've heard since the 90s.
               | 
               | I'd strongly encourage doing a deeper dive here.
               | Functions in JS are objects and can have their own
               | methods/props + scope. They're a first class citizen.
        
               | nsonha wrote:
               | people are stupid only you, some javascript coder of all
               | people, knows the secret of programming, spit it out in
               | clear terms instead of making non-argument.
        
             | fenomas wrote:
             | I've enjoyed vanilla JS since forever, and currently work
             | in a TS shop, and FWIW I think you're _waaaay_ off base.
             | There may have been times and places where TS was heavily
             | OO, but all the TS I come into contact with is heavily
             | functional, class-averse, immutable by default, etc.
             | 
             | (In face, the Java/C++/OO-types I know strongly dislike TS
             | because it's structurally typed. TS doesn't care a jot who
             | extends what - as long as they have the same properties
             | it's happy. Hard to get more un-java than that.)
             | 
             | The real reason that TS won is simply that large teams
             | (e.g. hundreds) cannot effectively work together on untyped
             | JS. If you're doing a solo project, fill your boots - use
             | JSDoc comments, sprinkle asserts around, whatever. But the
             | webdev world at large doesn't care about Java or OO
             | concepts, it settled on TS because huge teams can work
             | effectively with it.
        
               | h335ian wrote:
               | There it is... that's the classic argument. Large
               | teams/codebase. I totally get the appeal, but the idea
               | this can't be done effectively without it is nonsense.
               | Long before TS, we had JS apps with teams of 50-100+
               | working across hundreds of not up to a couple thousand
               | files - in CVS/SVN repos (ugh). I will concede that TS
               | does help in the larger teams/codebases but - I will
               | contend it is not necessary if your team is composed of
               | folks that have depth of experience working without.
        
               | fenomas wrote:
               | Certainly we had large teams using JS before TS - back in
               | ye olde days before modules, when everyone picked or
               | built a smallish abstraction (e.g. jquery) and built
               | smallish unconnected things on top of it. But now that
               | modules are mature and thousands of files can all
               | reference each other, types are just necessary. They
               | don't _have_ to be declared in TS - you can get by to
               | various extents with JSDocs or inference - but there 's
               | no benefit to doing those things, so large teams don't.
               | 
               | What I am saying is, across several comments you seem to
               | be arguing that you think TS's massive popularity is
               | partly due to its proponents liking Java or classical
               | inheritance, or not understanding FP or closures, or
               | something. And that's just wildly not true. And it's also
               | not even true that the TS world particularly favors OO.
               | If you weren't saying those things and I misunderstood,
               | my bad!
        
               | h335ian wrote:
               | It's fair that there are proponents & value props beyond
               | those early folks that came from the Java type world.
               | 
               | I guess I'm tainted/jaded by the early proponents and
               | initial rationale that was absolutely tied to - "ewwww
               | dynamic types!?! Gross, where are my strong/static
               | types!?". I've just fought that too many times - and that
               | was a very strong argument at the inception of TS. There
               | certainly are value props that go beyond and more to be
               | discovered I'm sure.
               | 
               | I feel like MANY if not most of the devs I work with
               | today simply use TS cause "that's what you do these days"
               | - but they have no clue what the "why" is and are baffled
               | by native JS typing - and still consider JS "garbage" as
               | a result. Bummer. In the Scala community I hear so much
               | hate for NodeJS because it enables JS for server-side,
               | "where it doesn't belong" for many of these same old
               | reasonings about typing (even with TS!?).
               | 
               | So yah, there's value there, but you don't NEED it to
               | write large, good software. I'm clearly just jaded by the
               | religious debates that have gone on and on - so despite
               | their utility, I can come across very anti to the
               | "solutions" to IMHO shitty arguments.
        
             | nsonha wrote:
             | no one said any thing about functional vs oop. Why does
             | every vanilla js "veteran" think types === OOP and the
             | reason we do typescript is for OOP? How about basic things
             | like not even have a module system (before nodejs) for
             | Christ's sake? How about doing functional programing
             | properly, with types?
        
         | tengbretson wrote:
         | Is being a "prototypal language" not an "OO inheritance model"?
        
           | h335ian wrote:
           | Firstly, it's functional with closures... From there
           | prototypal - so you can express whatever you want... the key
           | is being functional. This was a key to the advent of JSON,
           | but is also one of the most elegant and powerful bits of JS
        
             | trashburger wrote:
             | You're wrong. The prototypical model of JS was inspired by
             | the Self programming language[0], itself a descendant of
             | Smalltalk. It is a very crude implementation for sure, but
             | it is object programming nevertheless. Closures being
             | present sours the purity a bit, but closures are poor man's
             | objects[1] anyway.
             | 
             | [0]: https://selflanguage.org/
             | 
             | [1]: https://stackoverflow.com/a/11421598
        
         | throwaway173920 wrote:
         | I think you are conflating ES6 classes with TypeScript.
        
           | h335ian wrote:
           | Static/strong typing is not necessary in JS.
           | 
           | Yes, ES6 brings the OOPiness
        
             | mynameisvlad wrote:
             | That's just like your opinion, man.
             | 
             | Just because you think that doesn't mean it's true. The
             | sheer fact that TS has overtaken JS for the majority of web
             | development says enough.
        
       | h335ian wrote:
       | Despite being down on all the extras, I wanna reiterate - I do
       | think this is a cool project and I dig that HTAs are still
       | around.
        
       | cdaringe wrote:
       | I saw a partial example, but not clear instructions on how to
       | bootstrap a project. Did I miss it in the README? Or should it be
       | obvious to me if I have some XYZ experience?
        
       ___________________________________________________________________
       (page generated 2024-08-22 17:01 UTC)