Live data from Hacker News

Ink: React for interactive CLI apps

github.com

91–100 of 109 posts

Re: Ink: React for interactive CLI apps

#91
post #27

Earlier quoted context omitted.

Some people here seem to have a hard time understanding that React !== DOM React is descriptive. It creates a virtual tree and tells how that tree should be changed. What that tree renders into is a completely different problem. On the web, it renders into HTML. On your phone (ReactNative), it renders into native GUI. In ink, it uses a render engine to concat and output the text results (it's a little more complex th…

Is there a good resource that explains what React is and how it works, without limiting the focus to just the usual web applications?

One way to look at React is as an open loop desired state system, where you have a declarative way (js/jsx) of describing what you want to render and the reconciler figures out what operations to do (in the DOM), ideally in an effective way. But you could swap out the render target to other things. I wrote about it some time ago https://branislavjenco.github.io/desired-state-systems/

Re: Ink: React for interactive CLI apps

#92

Earlier quoted context omitted.

XML is a much maligned and poorly understood technology. It lacks glossy pitch pages and hypemen like react. Things like XSLT are really quite good if you can get past "ew xml icky" You can inline different schemas in modular, bazaar like ways from a variety of sources and pull in different parsers that do different tasks. For instance you could have, say an object subtype and pretend you, a spreadsheet developer mad…

XML is insanely powerful, there are 1,000 page books on XML alone. But React is a much smaller standard that extends XML to an insanely effective point (assuming basic JS as base knowledge) It's because I like XML that I think JSX is a logical/effective extension and we should support it as the sort of "champion" of declarative design Just to emphasize this: Why has XML been losing as the standard config format? Why…

> Why has XML been losing as the standard config format?

The short answer, as you answered it, is:

> there are 1,000 page books on XML alone.

The long answer: it was over-engineered for the intended use-case.

It's easier to fix under-engineered stuff (like JSON) than to fix over-engineered stuff (like XML).

> If you like XML, there is a strong argument to support JSX because it's a way to keep XML around!

Well, this is basically pivoting XML to a different use-case. It'll still be over-engineered unless you stick to JSX only, in which case it's not XML anymore, anyway.

Re: Ink: React for interactive CLI apps

#93

Earlier quoted context omitted.

XML is a much maligned and poorly understood technology. It lacks glossy pitch pages and hypemen like react. Things like XSLT are really quite good if you can get past "ew xml icky" You can inline different schemas in modular, bazaar like ways from a variety of sources and pull in different parsers that do different tasks. For instance you could have, say an object subtype and pretend you, a spreadsheet developer mad…

XML is insanely powerful, there are 1,000 page books on XML alone. But React is a much smaller standard that extends XML to an insanely effective point (assuming basic JS as base knowledge) It's because I like XML that I think JSX is a logical/effective extension and we should support it as the sort of "champion" of declarative design Just to emphasize this: Why has XML been losing as the standard config format? Why…

React isn’t a standard

Re: Ink: React for interactive CLI apps

#95
post #32

Earlier quoted context omitted.

> Sure, but ten years ago, if I told you the concept of a “bottom type” would be common knowledge with web developers or they’d consider type algebra second nature, you’d have laughed at me. If you told me that was the case today with web developers generally, I’d laugh at you even harder than I would have if you made that prediction ten years ago.

All the web developers I've worked with in the last four years understand the concept of a bottom type, even if they've never been introduced to the formal phrase, because `never` is the explicit bottom type in TS and appears all the time. You can't go very long consuming libraries written in TS before you run into it, at which point you become familiar with it. Similarly, a function that accepts (explicitly) `A | B…

> All the web developers I've worked with in the last four years understand the concept of a bottom type.

It's the opposite in my experience. Most web developers I work with (a lot because of consulting), specially the average "React sprint runner" doesn't have a clue about anything slightly above basic types and just google/chatgpt whenever things break so they can move on to the next task in the sprint.

cryptic typescript errors don't help here either.

Re: Ink: React for interactive CLI apps

#96

Earlier quoted context omitted.

Haven’t used this library, but the answer is the same as it is for real React apps. How does this application perform if I have a scrollable view with 50,000 items in it and I press the down arrow? This kind of thing is why React can be the cause of bad performance.

What kind of TUI are you making that requires a scrollable view of 50k items?

Any log viewer.

Re: Ink: React for interactive CLI apps

#97

Earlier quoted context omitted.

> the most robust type-system in the world (Typescript) This is very high praise for something that only provides safety at compile time and not runtime.

Not to mention: type Thing = string | boolean; const arr: string[] = []; function add(item: Thing, dst: Thing[]): void { dst.push(item); } add(false, arr); Is valid typescript.

To me this is expected? Thing is supposed to be one or the other. If I wanted a homogeneous array I would use a generic for the add function, which makes more sense for a function that just pushes to an array anyway.

Re: Ink: React for interactive CLI apps

#98
post #45

Earlier quoted context omitted.

> the most robust type-system in the world (Typescript) The rare combo of Blub Paradox + Poe's Law

What would you consider to be more robust, while still being usable? I'm referring to the type system here specifically.

Haskell, any ML, Rust, etc. TS is on par with any crufty ad-hoc type system like that of Java or C++.

The TS type system is neither especially powerful nor especially robust

Re: Ink: React for interactive CLI apps

#99
post #32

Earlier quoted context omitted.

> Sure, but ten years ago, if I told you the concept of a “bottom type” would be common knowledge with web developers or they’d consider type algebra second nature, you’d have laughed at me. If you told me that was the case today with web developers generally, I’d laugh at you even harder than I would have if you made that prediction ten years ago.

All the web developers I've worked with in the last four years understand the concept of a bottom type, even if they've never been introduced to the formal phrase, because `never` is the explicit bottom type in TS and appears all the time. You can't go very long consuming libraries written in TS before you run into it, at which point you become familiar with it. Similarly, a function that accepts (explicitly) `A | B…

Meanwhile what I see is that everyone seems to think the {} type in Typescript means an empty object. Just because something has expressive power doesn't mean it's good.

Re: Ink: React for interactive CLI apps

#100
post #88

Earlier quoted context omitted.

Haven’t used this library, but the answer is the same as it is for real React apps. How does this application perform if I have a scrollable view with 50,000 items in it and I press the down arrow? This kind of thing is why React can be the cause of bad performance.

How many terminal apps do you know of that have 50,000 items with a scroll wheel? This is what I meant by 0.001%.

Since when is the basic pager an exotic terminal app?
Post reply on HN