News for hackers. Stuff that matters.
Re:Proton Native – React Native for the desktop by c-smile on Wednesday May 02, 2018 @08:28PM (#16982350)
Am I the only one who think that this:

    class Example extends Component {
      render() {
        return (
          <App>
            <Window title="Example" size={{w: 300, h: 300}} menuBar={false}>
              <Button stretchy={false} onClick={() => console.log('Hello')}>
                Button
              </Button>
            </Window>
          </App>
        );
      }
    }

    render(<Example />);
is using too many artificial parsing layers ?

1) Like run JS, then there 2) parse JSX that will build virtual DOM, then 3) interpret that vDOM to 4) create physical window.

Why not just

    let app = Application({params});
    let window = app.window({url:"content.xml",
                             type: "frame" });
Re:Proton Native – React Native for the desktop by uryga on Wednesday May 02, 2018 @09:04PM (#16982535)
Looks nice for a short example, but later you'd also need some stuff like:

    let button = new Button("Click me");
    window.attach(button, {position: 'center'});
To me, imperative widget creation gets tedious and hard to read pretty fast. I'm not a fan of the many parsing layers involved in the JS example either, but I really appreciate the declarativity they enable.
Re:Proton Native – React Native for the desktop by c-smile on Wednesday May 02, 2018 @09:15PM (#16982586)
I am not saying that you don't need markup at all.

Window content can still use markup. But it is not clear why do you need it for defining Application and Window abstractions.

In browsers DOM element is a subject of style applicability and events handling. But why do you need DOM nodes for application and window ?

Re:Proton Native – React Native for the desktop by always_good on Wednesday May 02, 2018 @09:24PM (#16982629)
What does your trivial wrapper actually improve though?

    window = (...children) => <App><Window>{...children}</App></Window>
Over the years I've learned that some boilerplate isn't bad. In fact it means App and Window are implemented in the same abstraction that I'm using.
Re:Proton Native – React Native for the desktop by crooked-v on Wednesday May 02, 2018 @09:05PM (#16982539)
JSX is JS. While there's technically 'parsing' involved, it's fundamentally just syntactic sugar:

    import { createElement as e } from 'whatever'

    return e(App, {}, [
      e(Window, { title: 'Example', size: { w: 300, h: 300 }, menuBar: false }, [
        e(Button, { stretchy: false, onClick: () => console.log('Hello') }, [
          'Button'
        ])
      ])
    ])
Re:Proton Native – React Native for the desktop by c-smile on Wednesday May 02, 2018 @09:11PM (#16982570)
"JSX is JS"

It is not, https://facebook.github.io/jsx/

It is handled by transpiler - one more parsing layer in loading sequence of your application.

Re:Proton Native – React Native for the desktop by azerothian on Wednesday May 02, 2018 @11:24PM (#16983129)
sounds like you have your project configured wrong, transpiling should impact compilation not the loading aspect of your application
Re:Proton Native – React Native for the desktop by mlsarecmg on Thursday May 03, 2018 @03:29AM (#16984029)
The transpiler is a build build (a babel plugin), it isn't even a part of the application nor does it run while loading. The snippet above turns into a bunch of nested functions.
Re:Proton Native – React Native for the desktop by tannhaeuser on Thursday May 03, 2018 @01:16AM (#16983512)
No it isn't, in the sense that it's not part of a language spec for JavaScript, like E4X (now deprecated) once was considered to become. But I guess E4X's problem was that it was too far ahead of its time and had XML in its name.

[1]: https://developer.mozilla.org/en-US/docs/Archive/Web/E4X

Re:Proton Native – React Native for the desktop by mlsarecmg on Thursday May 03, 2018 @03:28AM (#16984023)
JSX gets transpiled, not parsed. The effort is completely on the tooling side, there's no loading effort that changes JSX into functions. The main difference between your two snippets is that one is declarative and the other is imperative. The declarative piece can reflect state and react to changes, the other can't - you do that manually.