I think Kotlin is the statically-typed language I've been waiting for, especially with the team's interest in native and JS targets.
1,932 karma · joined February 2, 2011
I think Kotlin is the statically-typed language I've been waiting for, especially with the team's interest in native and JS targets.
I noticed that my daily streak grows just from doing a single exercise that day.
I recommend letting us set a point threshold (maybe low | medium | high) that we must meet to include the day in our streak.
It's a lot more motivating and beneficial to maintain a streak that requires an investment of 15-30 min/day.
This is where the "just wrap it" argument breaks down.
Though I think promises are only slightly better when you have if-else branches that add to the async chain. It's not til async/await where Javascript finally hits its stride.
Promises and especially async/await let you read code top to bottom once more, with other benefits like monad chains that catch synchronous failure.
One of them opted to keep their memories of the other on every reincarnation all those millennia, but the other didn't.
val handler = Router {
get("/", fun(): Handler = {
Response().text("Hello, world")
})
get("/<a>/<b>/<c>", fun(a: Int, b: Int, c: Int): Handler = {
Response().json(J.obj("sum" to J.num(a + b + c)))
})
}.handler()
Server(handler).listen(3000)
It has a lot of features half-stubbed out to a hobbyware level from a type-safe router to content negotiation to JSON decoder combinators.I was in the market for a statically-typed language to use on the server and gave Kotlin a shot.
After rewriting an old, large log-parsing program, I was impressed with Kotlin's mix of simplicity and expressiveness. The designers definitely spent some quality hammock time.
I wrapped Jetty's `(Request, Response) -> Unit` signature in a `(Request) -> Response` signature which I always liked because it's easier to test and it means middleware becomes a higher-order function `((Req) -> Res) -> ((Req) -> Res)`.
It has some goofy abstractions, too, and plenty of `// TODO:`'s in the code. I couldn't even figure out how to get it working with jRebel much less roll my own hot reload.
But I think I got it to a point where it might be interesting to other weekend-ware warriors.
For one, I thought I was helping out by alphabetizing all the methods.
Ended up with a diff that basically scrambled all 100k lines of the project's largest file. It's probably still causing merge conflicts to this day.
http://docs.scala-lang.org/overviews/core/futures.html#block...
> if I'm server side and using something dynamic, I might as well
> use something nicer like ruby or python.
You could say the same thing about Javascript. "Might as well use the language I already use on the front-end."The code is pretty much identical between Ruby, Python, and Javascript once you have a yield/await abstraction in the latter.
Not an easy drive to make with triplets, but we loved it. Didn't make a peep.
Surely the best practice is to use something like koa or otherwise create a promise chain with a top-level 500 handler.
Then there's synchronous 3rd party library stuff where you just want to execute a Javascript function, like a math function that you aren't going to reimplement in Elm. In that case, I wrap the function with a native module and call it like an Elm function. Since you talk of computation, is this what you're talking about?
The Elm community highly discourages native modules. For one thing, they aren't very well documented and the API seems to have recently changed. But I'm not sure what the alternative is.
{(() => {
if (cond1 && cond2)
return <div>foo</div>
else
...
})()}
Though it makes GitHub think it's a Clojure file.On the Javascript side, the Elm `app` is like an event emitter where you listen for updates and send it data.
var app = Elm.Main.embed(...)
app.ports.gameState.subscribe((data) => ...)
app.ports.tileClick.send([x, y])
On the Elm side, you subscribe to incoming ports and map them into Msgs. And you emit to ports with Cmds from your update function. -- Ports.elm
port gameState : Json.Encode.Value -> Cmd msg // Outgoing
port tileClicked : ((Int, Int) -> msg) -> Sub msg // Incoming
-- Main.elm
update msg model =
case msg of
Tick ->
-- Define `encode` to Json.Encode the game state
(model, Ports.gameState (GameState.encode data))
TileClicked (x, y) ->
-- Handle tile clicks sent in from Javascript
subscriptions model =
Ports.tileClicked TileClickedRedux, Om, Reframe, Elm, etc. They all amount to hooking up components to a state transactor where the business logic lives separately.
Semantic HTML seems like a trade-off where you clean your markup at the expense of indirection, not a universal aspiration. And components don't dictate where your styling should live.
Not just because of the compiler errors, but also because of its other limitations, like having your effects isolated via `Cmd`s and ports.
Javascript is ubiquitous, runs in the browser + server, everyone I meet in the wild has to know it, and it has static typing options. It's not easy to shove those aspects under the rug to justify another language. It takes something else, mostly depending on just who I'm working with and then on what we're building.
A paid tier is a surprisingly narrow business model. People aren't willing to pay for much, and not every website has such an explicit product. A lot of that is just conditioning, as people aren't used to having to pay for anything since ads. And most people see ads as zero-cost. The second you start charging a dollar, now you're the guy charging the dollar that nobody else is.
How many forums do you pay for?
And donations are almost always a joke. Else you wouldn't have to beg in a way that puts most ads to shame: https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/nv9ad0..., and that's for a website that brings value to just about everyone that touches the internet.
Application code that touches the file system is still deployed along with the application code.
You might commit schema.sql into your application repository, but that's not the state of your database.
For example, carving out some time at night for your side projects that might pay your rent one day vs. staying longer at work to get a leg up on imminent deadlines that were too aggressive vs. working hard to be Employee of the Month vs. working hard to learn programming.
> Start slow, build your foundation, learn your bits and bytes,
> data structures and sorting algorithms first then venture out.
Maybe that works if you've already convinced yourself that you're going to learn to program no matter what. That certainly wasn't me, though.In my experience, the challenge for beginners is that they lose interest and make no progress at all, not that they take some suboptimal path.
It's like picking up a guitar. You can come up with the Perfect Five-Year Roadmap and preach about how someone should first learn music theory and proper form before taking a crack at it. But for most people, that's dull and they'd never learn guitar if they had to do that before jumping in and just trying.
I think beginners should optimize for doing anything at all, and nothing should be advised against as a suboptimal route. The optimal route is the one that compels them, even if it amounts to faking it til they make it with a game framework and devoting 75% of their time to things completely unrelated to programming.
Sorting algorithms? Bits and bytes? Seriously? I started dozing off during that sentence and I've been programming in some form for at least 10 years. That's not how you're going to woo most people into programming.
Redirecting them to the HN pit of cynicism and leave-no-stone-left-unturnedism sounds awful. :)
If you find yourself credentializing in the source of an SSG because it turns out you're doing something it doesn't support, then there's a point where it might've been faster to build as a dynamic site (more general tooling) with a static site build step.
It's an easy place to find yourself since so many SSGs generalize around blogging.
I agree that it would be nice to have IR for those times you want shorter bursts. But I ran into its shortcomings too quickly as a daily burner, not so different than trying to therapeutically bump cocaine.
There's also dirt cheap generic IR but there wasn't generic XR back then (still?).
> Vyvanse put me to sleep, adderal-xr worked, but the "come down" sucks
Adderall does have a bad come down. Often depressive even on low XR doses.Vyvanse is still amphetamine, so if it put you to sleep, are you sure you took enough?
20mg Adderall XR is about equivalent to 50mg Vyvanse, which is what I take.
Everyone I know switched from Adderall to Vyvanse and we all report the same thing -- much more gradual curve throughout the day and far less depressive on the come down. I'd consider Adderall XR to be a real tweak compared to Vyvanse and far less therapeutic for a day-to-day drug.
I can't think of a single upside of IR over XR unless you use it recreationally and want that steep curve.