Hacker Newsnew | past | comments | ask | show | jobs | submit | ravicious's commentslogin

Flow is quite good, but over half of our React codebase is components connected to Redux or Redux Form and unfortunately there are no Flow types for the versions that we use, so type inference is very weak at some points.

Besides, Flow has a very ambitious target of delivering types for APIs which were not written with types in mind at all. I thought I'd be able to recreate some of the Elm's type safety with Flow, but that's just not possible and I doubt it'll ever be. But then again, these two projects have very different objectives.


>> When giving feedback, some people say that they are brutally honest

> As someone who prefers giving and receiving terse feedback... I would suggest that there's nothing wrong with brutal honesty for type of people who appreciate receiving it.

It seems to me that you cited the fragment of donw's comment about "brutally honest", but ineffective feedback ("The module you wrote is crap because your code sucks and is hard to maintain.") and then started arguing that some people like receiving terse feedback.

But won't you agree that the example of "brutally honest" feedback wasn't in any way terse and that "brutally honest" doesn't necessarily mean terse?

I find the second part of the "kind" feedback much more terse: "Breaking those big methods and classes into smaller separate objects and functions would help a lot".


I left a comment under your post on reddit. For us, JSPM is fast enough and we don't have to run a second server just to serve assets.

And, excuse me for saying that, but I found your post lacking in substance. Writing "It's super slow, we've tried everything" doesn't show us about what you've tried and with a detailed explanation maybe the thousands of eyeballs who saw that post would be able to help you find the problem you had. ;)

https://www.reddit.com/r/javascript/comments/42ozl3/why_we_s...


I think JSPM should stress the part about bundling. It's the second person that I see who says "JSPM is slow" and the reason behind this slowness is that they didn't bundle the files or bundled them incorrectly.

We do the same in our project: we bundle all the 3rd party libs when they change, so only our own code gets retranspiled on each page load. During deployment, we bundle all the JS in a single bundle (which is good for us, as we don't have too much JS in that project).


Any chance you can go into detail how you bundle your 3rd party dependencies separately? I have tried that, without much luck.


For me it's like this:

> jspm bundle app//* - [app//*] js/tmp/dependency-bundle.js --inject --no-runtime

That tells JSPM to bundle everything except your application if your app lives within the app/ directory.

> jspm bundle babel js/tmp/bundles/babel.js --inject --skip-source-maps --minify

This tells it to bundle the Babel dependencies which aren't considered in the above.


Using bundle arythmetic.

jspm bundle src/app.js - src/[/*]

This will tell jspm to bundle src/app.js with all its dependencies, excluding everything in the src/ directory. This will result in JSPM bundling only your dependencies.


> The advantages [ClojureScript] has over ES6 fail to make up for the loss of a huge ecosystem…

What kind of "loss of a huge ecosystem" did you have in mind?

> …and this only seems to get worse because of the rate big JS community innovates (whether you'd classify this as 'churn' is another matter).

Last time I looked at CLJS and JS, it was the JS community that was catching up with CLJS (figwheel vs hot reloading, re-frame vs redux). People like David Nolen, Bruce Hauman and Mike Fikes are doing a lot of stellar work!


Maybe instead of creating something entirely new we could improve the existing thing, that is prepend man pages with some examples?


There have been discussions in the past about "standardizing" on an Examples section. It is usually what I miss the most in any manual.


The man maintainers, at least from my own dealings with them, often don't like contributors. "Examples are nice, and I like your changes, but what if Paul Vixie doesn't?" It's easier to fork man completely and take it away from them, Xorg style.


"I've done this, to fix the problem." "Ah yeah, no need; that problem's been discussed in the past". "Ok, what happened" "IT...WAS...DISCUSSED!"


You're free to try to incorporate these into the man pages. The creators of this (brilliant idea, btw, just what I have desired so many times in the past) are under no obligation to do so.


I still think that by preferring composition over inheritance things are just simpler and you don't have to trouble yourself with super or with before/after calls.

Maybe I just haven't been bitten by the dependencies labyrinth yet.


What about private functions? For now I just add `_` in front of their names, but the code would look so much cleaner if I had some kind of a `private` keyword.


I don't see why this technique wouldn't also work for methods, especially with the addition of computed property names [1].

[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...


This technique absolutely works for methods. And again, this shows the elegance of having simple features that compose, rather than building a monolithic OO system.


In practice, that turns into far too many ways of defining classes in Javascript. There are at least four major approaches, and that was last year.


If you want something that isn't in the language, you build it yourself. If what you build becomes popular, in the fullness of time it gets built into the language as a full feature or as syntactic sugar. That's exactly how we got the class keyword, modules, everything.

But if you choose the wrong thing, one day your choice is obsolete. That is a risk, and it's prudent consider the consequences carefully.

If that troubles you, by all means write your code without any encapsulation, and wait for the language to acquire the feature in a few years. In the mean time, your code base will grow without that kind of encapsulation. Only you can determine whether this is a bad thing or not. YMMV, and all that.

This is a very common problem to ponder, we end up arguing about whether you should be an early adopter, a main streeter, or a laggard.

But really, the post isn't a screed in favour of using private properties, it's a suggestion that making classes out of first-class values in the language gives us the flexibility to build whatever we think we need.

Private properties is a particularly simple example. Traits and mixins are also useful, but would take even more space to articulate. But the general point is still that making new things ("classes") out of the existing materials ("functions and prototypes") is a win in general.


That's part of why I think CoffeeScript isn't going anywhere anytime soon.


Sure thing, but could you show an example? Let's say we want the `rename` function be private, this is what I came up with: https://gist.github.com/ravicious/5412eebf8a1934ec7886

I don't particularly like this solution, because now I can't just write `this.rename()` in other Person functions. That's why I'd rather have a baked-in way to define private properties & functions instead of having to use (in my opinion) this weird syntax and later explain the whys and hows to other developers.


Writing this[rename](...) instead of this.rename(...) is hardly onerous.

Your solution mostly works, but a simpler one takes advantage of combining computed property keys and compact method syntax:

https://gist.github.com/raganwald/18f8c179101cfd93c291


Okay, now this certainly feels better than my example and is much more bulletproof than prefixing function names with `_`, thanks.


You wouldn't be able to simply; the same issues exist as in ES3 in this regard.

(I wrote about them extensively years back here: http://mikegerwitz.com/papers/coope/coope.pdf.)


You don't really need a framework, one can get pretty far without it. Look up Facebook's Flux examples[1] to see how they're doing it.

[1] https://github.com/facebook/flux/tree/master/examples


I tend to agree. Even as an author of one of the Fluxes (Fluxii?) mentioned, I still think this is the best approach. All of implementations I've seen simply formalize patterns the author was repeating on multiple projects.

(There's also know obligation to use them, the joy of OSS!)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: