Blockdiag - simple diagram images generator - <AUTHOR> http://blockdiag.com/en/index.html

<comment><USER2> Does anyone know of other software that can be used to prepare network topology and rack layout diagrams from simple text files? Blockdiag seems to be one of the few options available so it'd be nice to see a focus on this "niche".

<comment><USER3> There's graphviz, which is pretty damn cool. <http://www.graphviz.org/>

</comment></comment><comment><AUTHOR> I like simple tools like this. They fit both nicely into various workflows and into the 'Write programs to work together. Write programs to handle text streams, because that is a universal interface'-mindset.

</comment><comment><USER4> It would be interesting if it could generate some tex/latex code :)

</comment><comment><USER5> A quick and informal tool I have used over the years to create simple block diagrams is yEd. Since it is Java it runs on Windows, Mac, and Linux. Its free, but not open source.

<comment><USER6> yEd is a beautiful simple diagram-drawing tool but it's essentially "just" a slimmer cousin of e.g. Visio: Click to draw blocks, join them with arrows, drag things around with your mouse until everything looks nice.

I'm one of those obsessive-compulsives who can be completely infinite-looped by any product that lets you manually tweak the appearance of your diagram by hand and mouse. "Another 1/8 inch to the left, now a bit more spaced out, oops, now this part isn't centered, so pull this..."

blockdiag is different insofar as you specify the diagram by text only. It doesn't offer enough degrees of freedom to engage in the "creativity" that is so lethal to me. You tell it the names of your boxes and how you want them connected, and the software does the layout in a simple and unambiguous way.

I also highly appreciate that this allows me to source-control the diagram in text form and at what is probably the most abstract level possible.</comment></comment>


Facebook and StudiVZ battle over Germany - <AUTHOR> http://www.iht.com/articles/2008/08/07/technology/social.php <comment><USER2> It's true that studivz copied the Facebook UI nearly 1:1 and made it red instead of blue but they still lack some more advanced features like an API. Facebook is also not a huge success in Europe since every country has kind of their own facebook-clone.

 _"copied functions like a Facebook innovation that lets users digitally "poke" each other to get attention"_

Sorry, that's not an innovation.

<comment><USER3> It is if it's done in the purist way Facebook uses it. Sounds dumb but bear with me for a moment.

Facebook is all about levels of communication. You can tag somebody to draw their attention to what you've done, you can write on their wall to chat publicly, you can write privately if it's either a walled-in discussion (set number of speakers) or if it's something too sensitive to say out loud.

Poking, which I think I'm right in saying Facebook made first, is a method of bridging the small gap where you want to talk to somebody but you don't know what to say. It's the equivalent of small talk when you do it with friends: it's just a matter of alerting them to your presence. With people you don't know so well, it's even more a matter of flirtation: you don't have to explain your poke, or pretend there's a reason. All they know is that you've poked them, for whatever reason, and by doing so you've been brought to their attention.

So, if it's being copied in the exact same manner, used in the exact same way (where "poke" is an option on the level of "send message" and "add friend" on every menu), then yeah, they might have a point about copying a feature. Poking is simple like Twitter is: yes, it's basic, but what matters is implementation.

Also, regarding that site's layout: yech. It's like they took the brilliantly minimal Facebook design without realizing what made it such a brilliant design, and added tweaks to something they didn't quite understand. Sickening.</comment></comment>


How I automate my home - <AUTHOR> https://japaniot.github.io/2020/01/01/how-i-automate-my-home-en/ <comment><USER2> Whenever I read any post about home automation, it might as well be talking about a completely different world from mine. I've automated a lot of my house using pretty much just FOSS solutions. The Sonoff series of switches/devices is fantastic and ESP8266-based, so you can flash it with any firmware you want[1]. I wrote a small ad-hoc server to orchestrate things like "when there's motion in that room and it's dark, turn on that lamp", but you can just use Home Assistant.

I have a WiFi network that has no internet access where all these go, with access to a local server running an autoupdater[2] so I can just put the new firmware in a specific directory and all my devices autoupdate.

All of my devices are FOSS so I know they aren't talking to a mothership, and even if they tried to, they can't get on the internet. I do have an Alexa, which I should get rid of, since it's pretty much barely only useful for playing music.

This way is much more secure, companies can't spy on your house, and you're supporting user freedom.

[1]: [https://github.com/xoseperez/espurna](https://github.com/xoseperez/espurna)

[2]: [https://gitlab.com/stavros/espota- server](https://gitlab.com/stavros/espota-server)

<comment><USER3> Do you know any FOSS camera?

<comment><USER2> Yes, I got the Xiaomi Dafang something, there's a FOSS firmware you can flash onto it that's quite good. Not great, but I haven't found any camera with great firmware, open or not.

</comment></comment></comment><comment><USER4> I just have my kids do stuff.

"Water the yard!"

"Turn off that light!"

"Change the channel!"

"Go get the mail!"

Simple. Fairly reliable. Best DIY project the wife and I have ever done.

<comment><USER5> Really, really expensive solution.

<comment><USER6> Not only that, you're forced to support it for (at least) 18 years after the last version is released.

Requires a lot of maintenance the first few years especially!

<comment><USER7> ... with nearly continuous updates.

<comment><USER8> Some not by you!

</comment></comment></comment></comment></comment><comment><USER9> I dunno, I find it pretty hard to get on board the home automation train. I feel like, working in tech, we know better than anyone else how incomplete or unreliable these systems can be, so why introduce it to your home? Why replace your plain old metal kettle with a fancy smart-kettle that you can turn on with your Alexa, but would easily crap out on you if your Internet goes down, or some circuit breaks, or Amazon's API starts being flaky, or you lose electricity in your home? Shouldn't we be a little more worried about introducing this kind of extra complexity into our lives?

(^ these aren't meant to be sassy rhetorical questions, I'm genuinely curious if everyone else just views this a different way than I do)

<comment><USER10> There's another part that people forget: analog tech is nigh bulletproof. Your $50 smart light switch may last a decade or more, but a $0.50 analog light switch will last a century. The extreme difference in cost often leaves you with something that is worse in the long run.

Agree about the complexity as well. Analog circuits don't have an API that changes every few years — a modern 3-way light switch circuit would be easily understood by an electrician from 1920 (and vice-versa). Good luck doing that with Lutron gear from a decade ago.

I probably dropped $5k on home automation stuff. While I could afford it and it was partially a research project, the main lesson I learned was that home automation is generally more trouble than its worth at any price. Sure, it's great that I can tell Alexa to turn my lights off, but I also have to make sure that the 3 services required to make that work remain talking to each other. I would cumulatively save more time by just walking downstairs to turn the lights off.

<comment><USER11> I use Alexa for one light that never got connected to a light switch. I used wireless X-10 for it previously :-)

I agree about reliability. It's one reason I won't get a Nest thermostat. I live in snow country and I'm not going to do _anything_ that potentially introduces a new failure mode into my heating system.

(I actually have a couple of the Nest smoke detectors. The internet connection isn't required for them to function as dumb detectors and they work well in my experience.)

<comment><USER12> An internet connection isn't required for the Nest thermostat to operate the furnace either.

I can appreciate not wanting to allow Google the opportunity to brick your thermostat (and hence your furnance) through some kind of software issue but if you're willing to extend that faith to their smoke detectors, why not your furnace?

<comment><USER11> I guess my feeling with the smoke/CO detectors is that I also have other "dumb" models throughout the house. Furthermore, a thermostat needs to work basically all the time at certain times of the year, whereas the detector only needs to work when there's something to detect. I guess Google could silently brick them and I'd never know about it but that seems to be getting into paranoia territory. (And it's not like other detectors can't silently fail too.)

It's probably paranoia about the thermostat too TBH. But other than looking cooler than my old programmable Honeywell, a Nest thermostat also wouldn't really do anything for me anyway.

<comment><USER10> Yeah, the Nest was ahead of its time in 2010; but by 2012 the big players like Honeywell and Carrier had caught up. At this point they beat Nest on both price and features. A good friend of mine owns an HVAC company and would recommend a dozen thermostats over a Nest on functionality alone.

</comment></comment></comment></comment></comment></comment><comment><USER13> As a security-conscious professional, and home automation enthusiast, I'm profoundly disappointed that HA's ultimate commercial breakthrough was accompanied by proprietary vendor lock-in and insecure "cloud" strings attached (looking square at you, Alexa).

<comment><USER14> While that's true, we've also seen huge growth in stuff like Home Assistant, which goes a long way towards returning control to the user. Home Assistant integrates with the locked-in systems where possible, but also makes it easy to integrate local-only options.

It's definitely a small drop in the home automation ocean, but it's a healthy ecosystem, available to anyone that wants to use it.

</comment></comment><comment><USER15> In the past year I have probably spent no more than a couple of minutes thinking about my light bulbs, my smoke alarms, my door locks, etc. They just work.

It seems like home automation has a lot of advantages but it would also require me to spend time on it (which products to buy, how to secure them, dealing with malfunctions, upgrades, batteries...), which probably amounts to an overall net loss of quality of life.

<comment><USER16> I live in an apartment, so I can't install ceiling lights. I'd have to hit ~8 switches on walls and lamps to fully illuminate my place. If I had smart bulbs, I could use one switch, or a voice command. I guess this isn't a problem if you already have a house and are free to wire it up intelligently to begin with.

<comment><USER17> Precisely. I recently stripped out my apartment (that I own) completely and redoing the electrical wiring and I have zero interest in installing smart stuff. I just have 4 dimming switches all next to each other that control all the zones, at both ends of the apartment. I can't understand how home automation would improve my quality of life if you factor in the added complexity.

<comment><USER18> It's nice to have an automation to turn off all the lights for bedtime when you live with people who routinely leave the basement lights on, for example.

</comment></comment></comment></comment><comment><USER19> I really prefer using physical analog light switches that don't require internet access, and don't send my data to big tech cos. Maybe I'm just old fashioned.

<comment><USER20> Almost none of this stuff requires an internet connection and it goes way further than simply turning your lights on/off.

<comment><USER21> Does Alexa et al work without internet as well? We need a local closed-circuit voice recognition equivalent to be the brains

<comment><USER22> Voice recognition isn't automation, it's an elaborate remote control. Real automation is having the room lights react to stuff like motion, presence, time of day, ambient brightness, and whether you're watching TV.

Telling Alexa to turn the lights on is more of a Rube Goldberg hack.

<comment><USER21> Does home automation _require_ internet for anything?

<comment><USER22> Not inherently, no. I'm building out my home automation with mostly ESP8266 based sensors, relays, modules etc. About half of those are NodeMCU, the other half are commercial devices flashed with custom firmware. My biggest "win" so far is taking over thermostat control of the whole house ducted AC. I now have it automatically change which room it prioritises temperature stability based on presence and time of day (when the child goes to bed).

My system "relies" on an internet connection for just one thing right now: iPhone push notifications, which are merely informational and mostly for debugging. It also uses the internet to keep my local NTP server in sync. When I'm away from home I can manually check on stuff with a VPN.

In future I plan to expose a minimalist HTTPS api for triggering certain actions remotely, like the garage door. But even that's not a big deal right now because I've got a outdoor AP that covers a wide area outside my house—my phone is generally already on wifi as I approach home by foot.

</comment></comment></comment></comment></comment></comment><comment><USER23> I don't think that ROI on home automation is positive, at least not for me. While the automations mentioned are nice for the author, it seems to be too much effort for too little gains.

For me, home automation suppose to free up your time for other activities.

Washing the dishes or clothes are great automation. I would look to other automation like changing the bed sheets, folding clothes, cooking the evening meals, grocery shopping etc. Let's talk again when these items become main stream.

<comment><USER24> i have adhd and early in the morning and late at night (when my meds have worn off) my brain just doesn't work right. home automation has been a major game- changer for keeping me on schedule and not getting engrossed in something and looking up only to realize i need to be getting up for work in 2 hours. I have a whole bunch of time based and triggered automations for all sorts of things.The time I save is not the extra 14 seconds to shutdown the house, its the time I save keeping on a schedule so I can actually do the things I plan to do rather than getting distracted and snapping out of it at 4AM to find that I have taken apart my dishwasher.

<comment><USER23> That is great that the ROI is significant higher for you. Can you share the specifics of a couple of your automations? I am genuinely curious.

</comment></comment></comment><comment><USER25> Most of the auto-lighting cases can be handled with a motion sensor and/or a timer. I've got two internet capable sockets and I've yet to found a use case for them.

The only case I found useful is using an internet capable magnetic sensor on the garage door to notice me when it's opened or closed, so that I have a peace of mind after driving off.

<comment><USER26> Can you share the link to the magnetic sensor you use on your garage door? I bought a MyQ[1] and it stopped working after the 11 months.

[1] [https://www.myq.com/smart-garage-hub](https://www.myq.com/smart-garage- hub)

<comment><USER25> [https://www.amazon.com/gp/product/B07CWLZWHP](https://www.amazon.com/gp/product/B07CWLZWHP)

It's a cheap generic magnetic sensor, not specifically for garage door. I used the small door hinge trick to adapt it to the garage door. [https://www.youtube.com/watch?v=o49xC- AXY9w](https://www.youtube.com/watch?v=o49xC-AXY9w)

</comment></comment></comment><comment><USER27> I'm surprised nobody mentioned Shelly smart switches since many people here are worried about manufacturer cloud dependency, obsolescence and security.

I installed a bunch of Shelly 1 smart switches ([https://shelly.cloud/shelly1-open- source/](https://shelly.cloud/shelly1-open-source/)), they work via WiFi in LAN (even with the manufacturer's App) _or_ Cloud (it's optional).

There is the possibility to manage them via REST APIs, all the smart switches serve a web page that can be reached via browser.

If you connect them to the Cloud you can optionally add Alexa or Google Home on top. They do not support HomeKit natively[1] nor IFTT.

I choose this solution because I wanted to automate part of my appliances and lights in my house _without losing_ the possibility to use the analog wall switches that I already have installed: Philips Hue lights are nice but if you switch them off via the analog switch in the wall the App or your favorite voice assistant can't work anymore. Furthermore, they are very expensive; at lest 20€ for a single 8W bulb (no other size available), while a single Shelly 1 costs half the price.

[1] but from the original link of the thread I found this [https://www.npmjs.com/package/@kacepe/homebridge- shelly](https://www.npmjs.com/package/@kacepe/homebridge-shelly)

</comment><comment><USER28> If you are interested in DIY home automation, you should definitely follow Jon Oxer at [https://www.superhouse.tv/](https://www.superhouse.tv/)

One of his biggest guiding principles which I strongly share is not needing an Internet connection for your house to work - which rules out most commercial home automation stuff that needs to talk back to home base.

He uses a lot of arduino and sonoff more recently. Also runs a lot of stuff with power over ethernet. All interesting stuff.

Lately he has been working a lot on understanding assistive technology hardware (e.g. wheelchair controller joysticks) and creating additional open hardware and software that can interface with them.

Well worth going back through his many years of material if you want to get into this sort of thing.

</comment><comment><USER29> This is pretty cool. After a year experimenting I found that turning things off/on in an if/then fashion doesn't add much value to me. The kind of automation I want is for chores that take time and are not much fun, like laundry. Turns out that doing that is much harder than turning things on/off remotely :).

I'm thinking of an assistant where I show (or tell it) what I want, and it just does it (it 'learns'), improving based on feedback from the users.

Hard-coding times in the day, for example, could be improved if the assistant knew what would be the ideal time to sleep to me, based on all the data collected for each profile of the people living in that home. It might ask me or suggest me things to do, having more flexibility than static rules.

<comment><USER30> Roomba et al is probably the biggest recent advancement in chores, although it doesn't work in every home.

<comment><USER11> I periodically think of getting one, but it would only work for a section of the house, albeit the section that could use the most regular vacuuming. But that same section is also where there tends to be the most clutter/cords laying about, etc.

In the end, my compromise was to get a good cordless vac which I can run for a few minutes if the crumbs and other debris get too objectionable.

<comment><USER22> Regular vacuuming makes carpet last longer because when grit gets between the carpet fibres, it acts as an abrasive and literally wears your carpet away with every footstep.

<comment><USER11> The trafficked areas the Roomba would work for mostly don't have carpeting. And where there are carpets, they're all decades old so I'm not too worried about taking new steps to prolong their life.

<comment><USER22> That's entirely reasonable. I mostly posted that as a PSA for anyone who assumed that vacuuming was only about cleanliness, not carpet life.

</comment></comment></comment></comment></comment></comment><comment><USER31> I'm curious what the state of the home automation installation/service market is these days; I do home renovation professionally and have a programming hobby so this seems like a fun area to get into.

<comment><USER32> Extremely expensive proprietary kit, obsolete (or requiring expensive upgrade) after a fairly short lifespan.

But of course the market for it doesn't care, and can pay for it.

I've thought about it similarly to you, but because of the labour cost of installation, it's an expensive job whatever the cost of the hardware/software, so there's not really a reason for installers to use HomeAssistant, OpenHAB, and the like. The difference will be thousands for hardware, on top of tens of thousands for the whole install job.

<comment><USER33> I work with Levven Controls, and what they offer to home builders is smart home controls on every switch and light in the entire home during construction, but for less cost than traditional wiring. There are no wires going to switch boxes, so that labour and material cost savings is enough to offset the cost of smart controls.

<comment><USER34> I assume no wires means battery powered. How long do the batteries last? Will I need to replace the batteries in all my light switches every couple years?

<comment><USER35> I have a similar system in my rented apartment, and there's no issue with batteries after 4 years so far.

I wouldn't choose it. Every ten pushes of the switch, nothing happens, and there's no visible / feelable state of the position of a switch.

<comment><USER33> The tactile feedback part of the switch is definitely an area we have tagged for improvement.

</comment></comment></comment></comment></comment></comment><comment><USER36> Love seeing this for HomeKit.

// Enjoy when we see HN thought leadership supporting use of security-minded or privacy-minded mass market products, rather than endless bashing of consumer products aimed at trust.

</comment><comment><USER37> Turning lights off and on and adjusting speaker volume in most homes are such simple things, it's hard to get excited about automating them. The home automation tasks I'd like to see: \- cleaning gutters \- putting dishes away \- sorting mail \- taking garbage cans down to the street \- unboxing packages and breaking down boxes \- folding laundry

These drudgeries take time. They're obviously not as amenable to automation as simple controls on existing electronics, but, in contrast to automated lighting, they'd be worth the investment to solve.

<comment><USER38> Automating lights doesn't seem super exciting, but as someone whose done it - it's been a surprising quality of life improvement.

The colours are cool. But the real power I've found is that every light is dimmable. It doesn't matter if you have a dimmer installed, which is not something you can usually do in a rental.

So, my lights automatically stay at the ideal level of brightness for the time of day. Later into the evening they only put out between 1-10%, and in some cases are set to only red.

Compared to living with lights that are either 0 or 100%, having that range in between has made a dimly lit house possible when it makes sense. And that's been so much more pleasant I'm never going back.

<comment><USER39> So, are you using smart lightbulbs instead of smart lights?

<comment><USER39> I mean, I'm asking because it's not entirely obvious to me, and smart light switches would be my goto, but you mention color.

I'm not sure why my question was a bad one.

<comment><USER38> Smart light bulbs.

The value comes is automating more than just on off, though I have some non light things I automate with switches.

Smart bulbs allow fallback with norma switches, and don't require modifications. Just swapping of a bulb.

</comment></comment></comment></comment></comment><comment><USER40> That's a pretty nice writeup, but I suspect some of the use-cases could be solved more easily with off-the-shelf parts.

For example I bought a couple of small LED-light boxes, they're about the size of a match-box and contain 5 LED lights and a motion sensor.

I've stuck a couple inside cupboards, and low down on the walls of our bathroom.

When it is dark and you walk past they come on for 30-seconds or so. Additional movement keeps them on.

Getting up to use the toilet in the night is much nicer with these low-level lights than turning on the proper lights and killing your night vision. (No lights would be fine 90% of the time, but children's toys get everywhere!)

<comment><USER41> > Additional movement keeps them on.

So it doesn't time out after those 30 seconds and you have to frantically wave your arms to get them to switch back on? As the sibling commenter said, what's the brand?

<comment><USER40> Linked a similar item below, these were just random finds at a local hardware store.

They're low enough on my walls that I've never really had to jump around to keep them alive though. I guess if you did literally walk out, then stand still for 30 seconds or so they would time out on you.

If you need proper light then you can use one, these are just little helpers if you need to get out of bed to deal with a child overnight, use the toilet, or similar. In practice they work really well.

</comment></comment></comment><comment><USER42> How to automate a home over a 100 years -

Electricity (fire automation)

Washing machine

Vacuum

Microwave/Rice cooker

Dishwasher

\</comment><comment></comment><comment></comment><comment></comment><comment></comment><comment></comment><comment>-----

Turing lights on and off with a super computer?

[Edit: The OPs post is interesting and cool as a hacker, it's just the actual next big thing in automation that will change lives will be something boring like an electric mop or duster. And if you want to automate your life, only having dishwasher safe plates is a good first step]

</comment><comment><USER43> The most intriguing feature for me was the automatic curtains. Does anyone have any experience with them? Suggested vendors?

</comment><comment><USER44> With the wardrobe light I'd prefer something simple like a relay that closes the circuit when the door is closed. Invert that signal with a transistor and buddabing buddaboom. Seems like more can go wrong once you start adding programming and iPhone apps and all this sort of stuff.

<comment><USER45> That's already too complicated. You want a normally closed switch (i.e. on when not pressed). When the door is closed, it's pressed, and the light is off. When the door is open, the light is on.

</comment></comment><comment><USER46> For the author: home assistant has had a native homekit plugin for a while, so you could move to a %100 home assistant setup if your devices are not homekit native.

</comment><comment><USER47> The ios app for home assistant works just fine.

<comment><USER48> Thanks! :-)

</comment></comment><comment><USER49> For the author: any tips or recommendations for electric curtains? I'd love to automate that.

</comment><comment><USER50> I would enjoy seeing a BOM for the hardware. I am looking for PoE circuit designs to roll my own.

</comment><comment><USER51> I'm curious why not use home assistant, and all the integrations that come with it, and then just expose them as homekit devices if you need/want to use homekit? Seems like it would save you a lot of time and custom code.

<comment><USER52> I suspect its because the native ios integration is far superior

</comment></comment><comment><USER28> My home automation efforts are pretty modest so far, but address definite pain points in my house.

Not really automated at all, but there is a LED in the ceiling near the front door that flashes when the garage door is open[1]. Seeing that light when coming down the hall has saved us heaps of times from leaving the garage door open all night.

I also have laser pointers hanging from the ceiling in the garage that are positioned so when the laser dot reaches the dash you know the car is in far enough.

Another not quite automated addition is using a Sonoff wifi touch light switch[2] in the lounge room[3]. Reflashed with Tasmota it allows us to easily turn the overhead lights on and off from the same remote control for the TV, Amp and Kodi media player. (Works via a script in Kodi.)

Probably the handiest is using an ultrasonic distance sensor as a presence sensor to tell the computer when I'm in front of it or not[5]. If music is playing when I walk away from the computer, it pauses then resumes when I come back. Also wakes sleeping screens when I return.

Just recently I wrote a little script that displays the number of minutes I've been sitting at the computer in the corner of the screen. At thirty minutes it turns from green to red and plays, "Move it! Move it!" sound, which it'll keep doing every five minutes until I get up and leave the computer for a little bit. (Although I think I'm going to have to change the sound to something that doesn't startle the hell out of me every time.)

Also have an analogue modem on the phone line that lets me initiate calls from my command line by just typing something like, "call dad" and it looks up contact information in my centralised contacts list. It also cross-references incoming caller ID info with the contact list and displays caller info on my computer screen and the Kodi media player[6].

If I were to really get into more home automation in earnest, I think being able to control the curtains in the house would be ahead of controlling lights. Hate wandering around the house opening and closing them all.

Two things I dislike about current trends in home automation are:

1) The requirement for an active Internet connection for a lot of your stuff to work. I want it self contained to the house and not sending information out into the world.

2) The need to have your phone near to you to use half the stuff. E.g., with the lounge room light switch mentioned above I can turn the light on or off at the switch (as well as the remote). I don't have to go find my phone and swipe back and forth five times just to toggle it.

One concept I find very interesting from the late 90's was the adaptive house[7]. It would learn things like your hot water usage, preferred room temperature and ambient light levels and used neural network reinforcement learning to optimise. I wonder how far this could be taken now with advances in machine learning.

[1] [https://www.michevan.id.au/posts/garage-door- sensor/](https://www.michevan.id.au/posts/garage-door-sensor/)

[2] [https://www.itead.cc/sonoff-touch.html](https://www.itead.cc/sonoff- touch.html)

[3] Aside: To my mind, in most cases it seems to make more sense to automate the switch, than automate the light bulb itself. Changing a light bulb doesn't need an electrician though, I guess.

[4] [https://github.com/arendst/Tasmota](https://github.com/arendst/Tasmota)

[5] [https://www.michevan.id.au/posts/are-you- there/](https://www.michevan.id.au/posts/are-you-there/)

[6] [http://ncid.sourceforge.net/](http://ncid.sourceforge.net/)

[7] [https://www.cs.colorado.edu/~mozer/index.php?dir=/Research/P...](https://www.cs.colorado.edu/~mozer/index.php?dir=/Research/Projects/Adaptive%20house/)

</comment><comment><USER53> Is anyone else conflicted by the desire for something better than a light switch in the home and the idea of bringing more tech into home. The negative of tech in the home being compromising privacy?

<comment><USER54> Yup, which is why I'm interested in privacy-oriented solutions like HomeAssistant. I think the main things I want are:

\- control temperature remotely (e.g. set furnace to turn on when I'm coming home from a trip) \- turn on/off power outlets to save electricity from "vampire" devices \- check for open doors/windows \- adjust airflow to make sure rooms are heated sufficiently

None of this requires sending data outside my home, yet the main smart home devices do. Also, I'm worried about security, and I don't trust these devices to update firmware appropriately.

So, until I get time to do it myself, I just do without.</comment></comment>


Swift is like Kotlin - <AUTHOR> http://nilhcem.com/swift-is-like-kotlin/ <comment><USER2> Kotlin lacks the ability to do true functional programming that Swift has. Swift has pattern matching, recursive data structures (edit: specifically ADTs with enums or case classes is what I was thinking of here, should have written algebraic data types), tail call optimization, even some form of type classes, immutability (thanks @tmail21), and so on.

Kotlin does not have any of these (edit: this is now partly false, see below)

I'm sad that Google is supporting Kotlin and not Swift or Scala for Android, since at least with the latter two, you can use functional programming.

Edit: Actually, I'm looking into Kotlin again, and it looks like it's greatly expanded support for functional programming compared to a year or two ago. For example, algebraic data types _can_ now be encoded in a similar manner to Scala, and kind of pseudo-pattern matched using `when`. TCO is now supported. There are lambdas, and support for closures. Destructuring assignment. But as far as I can see, still no immutable values (just immutable references), and no way to make extensible type classes, like in Scala and Swift.

I'm definitely going to take another look now. Last I checked a few years ago, Kotlin had very limited support for functional programming.

<comment><USER3> Maybe you haven't checked out Kotlin lately?

Kotlin has somewhat pattern matching: [https://kotlinlang.org/docs/reference/control- flow.html#when...](https://kotlinlang.org/docs/reference/control- flow.html#when-expression)

Tail call optimization: [https://kotlinlang.org/docs/reference/functions.html#tail- re...](https://kotlinlang.org/docs/reference/functions.html#tail-recursive- functions)

Type classes: [https://kotlinlang.org/docs/reference/sealed- classes.html](https://kotlinlang.org/docs/reference/sealed-classes.html)

And I'm not sure what you mean by recursive data structures. Basically every C style language I'm aware of can contain a reference to another instance of its own type.

It's more java-y than Scala, but it's fundementally capable of a very FP style.

<comment><USER4> > Type classes: [https://kotlinlang.org/docs/reference/sealed- > classes.html](https://kotlinlang.org/docs/reference/sealed-classes.html)

Those are not type-classes, at least not in the Haskell sense. They allow you to avoid an else branch, yes, which is actually quite useful; but one basic ability they're missing is the ability to define a new branch for a new instance of the type defined by library users.

Just as an example. They're really not much like type-classes at all.

</comment></comment></comment><comment><USER5> I feel like you could about as well write an article about how Go or Scala or TypeScript is like Kotlin. They all have some cases where they look similar or have some similar constructs borrowed from other sightly-less-recent languages. It doesn't seem like a very interesting or deep similarity.

If you want to compare them, going over the differences would be a lot more illuminating.

<comment><USER6> I don't know it for a fact, but this seems a response to Steve Yegge's catchy "Kotlin is better" (also on HN first page now).

<comment><USER7> In fact, it's linked from the Yegge post.

<comment><AUTHOR> OP here - Yes I posted the link after finding it in Yegge's post. I thought it was interesting to see examples of the two languages side by side.

</comment></comment></comment></comment><comment><USER8> Past the syntax similarities, both of these languages are intended replacements for an 'old' language (Objective-C => Swift, Java => Kotlin) on a dominant mobile platform, with interoperability as a major selling point (requirement?). As a mobile dev (mainly iOS) this is awesome to see and although I love me some Objective-C, working with swift has been a pleasure. Now Java on the other hand... ( _shudders_ ). With Google making Kotlin an official/first-class language and the syntax being so similar to swift I could see myself spending more time working with Android.

<comment><USER9> I assume Google will try to replace Java with Dart, because they have recently been focused on Flutter [1] [2] and Fuschia [2] development which are (mostly) C++ and DartLang stack.

[1]: [https://flutter.io/](https://flutter.io/)

[2]: [https://github.com/flutter/](https://github.com/flutter/)

[3]: [https://github.com/fuchsia-mirror](https://github.com/fuchsia-mirror)

<comment><USER10> > I assume Google will try to replace Java with Dart

I would have expected this, but not after pushing Kotlin. Kotlin is shiny enough to temporarily distract the typical developer from the daily struggles with the abysmal Android API.

Kotlin and Java it will be for the next 10 years, for better or worse.

Dart is not very popular within Google itself, and Fuchsia is nothing more than a paid hobby project[0].

[0] See [https://www.reddit.com/r/programming/comments/6a026o/googles...](https://www.reddit.com/r/programming/comments/6a026o/googles_fuchsia_smartphone_os_dumps_linux_has_a/dhbjmvx/) for a pretty damning review

<comment><USER11> > Dart is not very popular within Google itself

I was under the impression that pretty much all the frontend work at google was compiled from Dart.

<comment><USER10> Only AdSense.

<comment><USER12> Isn't AdSense a pretty big deal within google?

<comment><USER13> Yes, the Ads organization is huge and has a large influence on front-end development in general at Google.

</comment></comment></comment></comment></comment></comment></comment><comment> Black-Plaid It's strange that on the Kotlin side the author goes out of their way to show 'shorter' ways to do things that are also available in Swift but not illustrated.

        let sorted = [1, 3, 6].sorted()
        let sum = [1, 3. 6].reduce(0, +)

as examples

<comment><USER14> while we're at it [http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.16...](http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.1618)

<comment><USER15> Why are you citing an FP comp Sci professor? I must've missed something

<comment><USER14> seeing reduce in swift made me think about the universality of fold, which is the paper linked.

<comment><USER15> Ah, was about to say that all goes back to lambda calculus by Church and could be found in Lisp probably around ~1958.

<comment><USER14> Actually I think there's a relation with exponentials and integral calculus. Or anything hyper-iteration related.

</comment></comment></comment></comment></comment></comment><comment><USER16> The article is missing the similarities between Swift Optionals and Kotlin Nullables.

Swift code:

      var name: String?

      name? ///returns a safe value
      name! ///returns an unsafe value and throws an exception in case of a nil value

      if name != nil {
       ///Now we can use name! forcing unwrap because we know it's not nil
      }

      if let unwrapedName = name {
       /// Here we can use unwrapedName without forcing the unwrap
      }

The null checks are almost the same in Kotlin: [https://kotlinlang.org/docs/reference/null- safety.html](https://kotlinlang.org/docs/reference/null-safety.html)

<comment><USER17> kotlin make it a bit simpler, once you do name != null you can use it as it is never null after than, there is not need to use let. It makes it more readable.

</comment></comment><comment><USER18> One has structures, ARC, proper extensions, good protocols/interfaces, flexible enums, and runs natively. The other one doesn't. I think I'll choose the former.

<comment><USER19> One has a top-notch IDE from a top-notch IDE vendor. The other has XCode.

Also, ARC aside, for the 3-4 items you mentioned, either Kotlin also also has them, or has just as good alternatives. And none of those are life-changing. ARC vs a good GC is just a different tradeoff (no cycle detection vs pauses, etc).

I'm sure you can find some things where Swift is better at, and others where Kotlin is. But not that many to proclare one or the other the definite winner, and surely not a major one.

<comment><USER20> Sure thing...

When will Jetbrain have a decent interface builder?

Decent instrumentation?

Decent documentation viewer?

Can you get an object graph with JetBrains?

Xcode isn't perfect, but it's way better than JetBrains.

Just because one has one feature that one doesn't have, doesn't mean that Xcode beats JetBrain's IDE all day.

<comment><USER21> > Xcode isn't perfect, but it's way better than JetBrains.

O_o Are you kidding me?

People whinge all the time about jetbrains subscriptions, but I've literally never spoken to someone who's actually used their products and think that the alternative editors available (visual studio, xcode, etc) are actually better.

There are some features like UI designers that you can't do without, but it's been a long time since I met anyone who actually _liked_ xcode.

<comment><USER22> I tried AppCode to write in objc on mac and it felt way less transparent and smooth than Xcode. Idk if Xcode is missing some features, but all my real issues probably exist in different planes. My Xcode inconvenience points are: case-insensitive completion sometimes gets in my way, as it is with single lettered variables; it is easy to break constraints for non-trivial xib. I can live with both. What is it for you, in short?

<comment><USER19> Unless very recently XCode also crashed like crazy. So there's that.

</comment></comment></comment></comment></comment></comment><comment><USER23> I find it very annoying that Google and Apple are creating new languages to solve similar problems and not worrying about cross platform. If you write for Apple you've been told to use Objective-C and Swift. If you're on Android it's Dart and now Kotlin. None of that stuff is used for Windows or Linux development or even mobile on the other OS.

I'm not a fan of proliferation of "platforms" but when it goes beyond libraries and into the language itself I consider that a very serious problem.

This is forcing developers to write apps twice, or use a 3rd party solution to run on both OSes. Yep, they're refusal to work together and create standards is allowing companies like Microsoft to have value by offering yet another solution that works on both phones.

<comment><USER24> Imagine having just one programming language where there is likely one gatekeeper.

I doubt language innovation would happen with that setup.

<comment><USER25> Imagine having hundreds of languages with only trivial difference in syntax. Consider the fragmentation and effort wasted on re-inventing the same low level libraries again and again (here is the hundredth version of unit test library). Sure, only language would be bad but so is too many.

<comment><USER24> If a language has trivial difference from another language, I doubt it can gain traction.

Can you cite an example?

<comment><USER26> A language doesn't gain traction cause of syntax or anything like that. It gains traction because a platform developer promotes it.

C# and Java had what amounted to trivial differences, when they started.

Kotlin and Swift also aren't very far apart, both in terms of syntax and power (in Blub power continuum terms).

There's very Computer Science-y reasons for these languages to exist as separate languages, but they do cause of product differentiation and platform lock-in efforts.

</comment></comment></comment></comment></comment><comment><USER27> Does anyone else think the Kotlin syntax for array literals is super ugly:

val shoppingList = arrayOf("catfish", "water", "tulips", "blue paint")

What is wrong with square bracket syntax? (rant over).

EDIT: I suppose it's consistent with other syntax e.g. listOf() etc.

<comment><USER28> > Does anyone else think the Kotlin syntax for array literals is super ugly:

Well yeah, except it's really that Kotlin does not have array literals at all, arrayOf is just a variable-arity function.

<comment><USER29> I guess they think they are cool for being able to provide this feature through a library function rather than a language construct, but someone should tell them they really need to add some syntactic sugar that transparently invokes arrayOf while looking nicer.

<comment><USER30> It's worth nothing that Swift literals are _mostly_ library constructs as well. Any type conforming to ArrayLiteralConvertible can be instantiated using [...] syntax, for example. All other literal types (integers, floats, strings, dictionaries, etc.) have their own corresponding protocols you can implement. The only thing that's special for types like Array, Int, or String is that the compiler will automatically infer those types for a literal if there's nothing that indicates otherwise.

For example:

      let x = [1, 2, 3] // produces Array
      let y: MyType = [1, 2, 3] // produces MyType
      f([1, 2, 3]) // produces whatever type f() takes

</comment></comment></comment></comment><comment><USER31> I like swift's conditionals without brackets, OTOH the syntax for string interpolation is ugly

<comment><USER32> Ugh, I know it's something that literally every programmer on earth can and often does bikeshed, but Swift just got string interpolation syntax _wrong_. Parentheses are something that are often part of the interpolated expression... they shouldn't be part of the interpolation syntax itself.

<comment><USER33> Yes, agreed. IMO, curly braces would have made much more sense. It's not even bikesheding, really. It's just a fact that curly braces are less used in most written languages. I would also argue that curly braces are a better signal to the programmer that "something programmatic is happening here", due to their prevalence as scope delimiters in most popular languages.

Swift's string interpolation doesn't catch my eye like, say, Ruby's does: `#{my_var}`. It's very easy to gloss over `\\(something_like_this)`. I suspect they were going for a more "elegant" syntax at the cost of pragmatism.

<comment><USER34> I definitely think a general guideline for language designers could be "when in doubt, make it look like Ruby". The language has its issues, sure, but damn if it didn't get syntax _just right_.

<comment><USER35> I think we will have to agree to disagree on this. Personally, Ruby code is only marginally better than Perl in terms of line noise I can't read, a dubious distinction.

</comment></comment></comment></comment></comment><comment><USER36> There does seem to be broad agreement across a range of typed languages -- TypeScript, Swift, Kotlin, ES6 + Flow -- about notations for classes, control flow and data structure declaration.

But true convergence remains far away...

<comment><USER37> Is this broad agreement due to theoretical alignment, or a deliberate attempt to increase programmer adoption?

If true convergence happened, there wouldn't be a need for different languages. :-)

<comment><USER38> I think there is real convergence. All serious new languages have some form of static typing augmented with some form of type inference. All are lexically scoped. All have first-class functions and map/reduce/filter. None have unchecked manual memory management. None have checked exceptions.

There are still areas of debate, but at the same time I think there is real progress; we have learnt from past mistakes and they won't be repeated.

</comment></comment></comment><comment><USER39> Nitpick, the Hello World comparison is more like:

Swift

        print("Hello, world!")

Kotlin

        fun main(args: Array<String>) {
            println("Hello, world!")
        }

<comment><USER40> Kotlin has a REPL

<comment><USER41> So does Swift ([https://developer.apple.com/swift/blog/?id=18](https://developer.apple.com/swift/blog/?id=18)) ([https://repl.it/site/blog/swift](https://repl.it/site/blog/swift))

<comment><USER42> You've missed the point. He is saying that to get a hello world going in Kotlin you don't need to write a func if you are in the context of the REPL.

</comment></comment></comment></comment><comment> trevor-e Pretty good list. I don't think the tuple comparison is accurate though, I thought a data class is basically a value type (like Swift's struct) except with some stuff like equals, hashcode, and toString calculated for you.

Minor nit: the sort example needlessly uses two lines for the Swift version.

</comment><comment><USER43> Some considerations on the syntax (Swift first, Kotlin last in each pair)

        bad: \(apples + oranges) # using \ is looking for troubles
        good: ${apples + oranges}

        good: label + String(width) # even Ruby requires a .to_s here
        bad: label + width # surprises will follow

        good: ["Anna", "Alex", "Brian", "Jack"]
        super bad: arrayOf("Anna", "Alex", "Brian", "Jack") # make the long form optional

        good: for index in 1...5 {
        bad: for (index in 1..5) { # the useless ()

        bad: extension Double { # why do we need to be so explicit?
            var km: Double { return self * 1_000.0 }
        good: val Double.km: Double get() = this * 1000

<comment><USER28> > # using \ is looking for troubles

Are you referring to escaping and other special sequences (e.g. unicode codes)? Though it is odd-looking I actually find it rather smart that they decided to reuse an existing mechanism for that: aside from delimiters the only magical character in a string is \ rather than have e.g. both \ and $.

> # the useless ()

My beef is more with 1..5 being inclusive and there apparently being no exclusive range.

> # why do we need to be so explicit?

Why would you want syntax which is harder to parse, more magical, and has to be repeated for every addition, instead of an easily marked `extension` block which neatly parallels `struct` or `class` ones?

<comment><USER43> About \, yes it's the possible clash with a real quote. More an inconvenience to the reader that a source of bugs, but also that.

About ranges, Ruby has both .. and ... and after 12 years I don't remember which is what. Maybe an inclusive one is enough and 1..(n-1)

About syntax in general, it should be easy for developers no matter how hard it is for the compiler/interpreter to parse it. I don't like to have to type useless characters. Hence the () around if conditions and this extension thing. What else can it be? I'm defining a method of a class, no need for a special block. But I don't understand your "has to be repeated for every addition" so maybe I'm missing something important here.

<comment><USER28> > About \, yes it's the possible clash with a real quote.

Clash with a real quote? As in you paste random text from wherever and it turns out evaluated? You've got the exact same issue in Kotlin.

> About ranges, Ruby has both .. and ... and after 12 years I don't remember > which is what. Maybe an inclusive one is enough and 1..(n-1)

That's why I like that Swift uses "a..<b" for exclusive, you clearly see the top-bound being excluded from the range. It's readable and smart design.

> Maybe an inclusive one is enough and 1..(n-1)

I have never missed inclusive ranges in languages with only exclusive ranges (e.g. Python), the opposite would not be true.

> About syntax in general, it should be easy for developers no matter how hard > it is for the compiler/interpreter to parse it

That way lie Perl and C++ and undecidable syntaxes, I'm very much opposed to that.

> I don't like to have to type useless characters.

I don't see what's useless about saying what you're asking for. You define a struct your use a struct block, you define a protocol you use a a protocol block, you define an extension you use an extension block. It's readable and regular.

> But I don't understand your "has to be repeated for every addition" so maybe > I'm missing something important here.

If you're adding more than one item in Kotlin you have to repeat the receiver e.g.

        val Double.km = (thing)
        val Double.miles = (thing)
        val Double…

in Swift you just wrap it all in an extension block:

        extension Double {
            val km = (thing)
            val miles = (thing)
            val ...
        }

</comment></comment></comment></comment><comment><USER44> 0..<count is a lovely little piece of language design

<comment><USER45> What do you like about it? I was actually thinking the opposite...

EDIT: Genuinely curious, this is not meant to troll or start a war.

I like the more explicit feeling `count-1`. I'd use either...

<comment><USER46> It confused me as well. "0.. is less than count"?

<comment><USER47> Personally, I find that just having "0..count" requires a bit of thinking on my part trying to decide if it's inclusive or not.

"0..<count" instantly tells me that it's not including value, and follows the matematical interval notification [0..count] vs [0..count)

<comment><USER46> I'd prefer 0..count or 0..(count - 1) then.

</comment></comment></comment></comment></comment><comment><USER48> It is worth noting that both languages also resemble Scala.

see:

[https://leverich.github.io/swiftislikescala/](https://leverich.github.io/swiftislikescala/)

[https://agilewombat.com/2016/02/01/scala-vs- kotlin/](https://agilewombat.com/2016/02/01/scala-vs-kotlin/)

<comment><USER49> I personally think this exercise is rather odd in the first place. A lot of modern languages seem to have a same base syntax and these comparisons over simple operations is like taking all of the latin based languages and showing all the words that look similar.

<comment><USER50> Actually Kotlin is just Scala dumbed down by taking out the most powerful and interesting features like higher kinds, implicits, monads or macros. Which makes it just a Java 8 with a bit nicer syntax.

</comment></comment></comment><comment><USER51> Syntax should be a personal preference, installable module built on a standardized AST which compiles to whatever VM.

<comment><USER52> Microsoft's CLR is not unlike this idea. JavaScript transpilers are also similar.

</comment></comment><comment><USER53> Two Kickstarter mobile engineers (Brandon Williams & Lisa Luo) just gave a talk on this at uikonf two days ago, where they walked through the similarities and small differences. Talk should be online soon.

The kickstarter apps are open source so you can compare it yourself.

</comment><comment><USER54> I wonder if Google's support for Kotlin has anything to do with Oracle's lawsuit over Java, or is it just a cherry on the top? :)

</comment><comment><USER55> That's a great page - it's like one really cool language could come from the combination of the two. Each taken on it's own, they have their warts.

</comment><comment><USER56> As an iOS developer who's looking to port to Android, this makes it easier to manually port my Swift code to Kotlin. But I wish there were automated tools. If two languages are this similar conceptually, such a tool should be easy to write, and handle the majority of cases.

I don't mind if this tool prohibits a few features (pattern-matching in Swift, say), even if it's considered idiomatic, because not having to maintain another codebase saves more than enough productivity to make it worth it.

Does such a tool exist?

</comment><comment><USER57> Kotlin is the same jvm crap like Java. Please do not dare to compare it to Swift with its amazing llvm complier. True programs runs on true machine specific bytecode, not on stupid virtual machines that consumers every available cpu and memory (which leaks like hell). Please new programmers, syntax is BS. Learn to compare by looking at internals and advanced feature set and capabilities. Kotlin is a fad!

</comment><comment><USER58> Why not merge Swift and Kotlin?

Seems like they are very similar languages, with similar goals. They both want to be cross-platform. I suppose the competition is healthy, but at some point there's just a lot of duplicated effort. Although, I guess if they're both using LLVM, then it's not such a big deal. Maybe one day we'll see libraries that can be used by both Kotlin and Swift.

</comment><comment><USER59> The last example made me wonder if it's possible to do something like this:

val oneInch = 2.54.mm println("One inch is $oneInch.cm() centimeters")

<comment><USER60> My hunch says that in order to be anywhere usable, any extra arithmetic must be done inside curly brackets, much like in Perl or PHP. It makes sense and is easy to parse for both human and compiler.

      println("foo ${oneInch.cm()} bar")
      println("fez $quux")

</comment></comment><comment><USER61> 325 comments presently and sadly no one commented on what I find most exciting about Swift: integer overflow is trapped! FINALLY (the only other sane option is multi-precision integers, like in Scheme or Integer in Haskell). Does Kotlin do the same?

I presume Kotlin also traps out-of-range array accesses.

</comment><comment><USER62> Is there any tool that converts one to the other?

I think it is worst to have such similarities with very small different details than having completely different languages. For a developer working on both ecosystems it feels like hell to remember the tiny details.

</comment><comment><USER63> What ever happened to xtend, which I found a nicer balance between Java and Python-ish. Anyone have any experiences with it?

[https://eclipse.org/xtend/](https://eclipse.org/xtend/)

</comment><comment><USER64> Neither of them do what I want which is to write some logic code once (logic / network / persistence) and run it both on Android and on iOS.

What I do now is use j2objc, but here I am stuck in Java land.

</comment><comment><USER65> waiting for a language that transpiles to Kotlin and Swift

<comment><USER58> Here's an attempt to transpile Kotlin to Swift: [https://github.com/moshbit/Kotlift](https://github.com/moshbit/Kotlift)

(Not updated recently.)

</comment></comment><comment><USER66> I've never really heard of Kotlin, is it supposed to be a Java replacement?

<comment><USER67> Yes, it runs on the JVM and is 100% compatible with Java code. While it was fairly easy to use Kotlin with Android before, Google just announced first- class support for it at IO.

</comment></comment><comment><USER68> Would be great if someone could add a third column for Java.

</comment><comment><USER69> algol based languages are all similar. It's like comparing scheme and closure.

</comment><comment><USER70> * A feature I like about kotlin are the receivers, with which you can write type-safe builders: [https://kotlinlang.org/docs/reference/type-safe-builders.htm...](https://kotlinlang.org/docs/reference/type-safe-builders.html)

* Multiple receivers are possible enabling extension methods like this:

        class EnglishToGermanDictionary {

           val translations = mapOf<String, String>(
              "dog" to "Hund"
           )

           /* extension method for string in the context of dictionary */
           val String.inGerman get() =
              translations[this@String]
        }

        /* usage */
        with (EnglishToGermanDictionary()) {
           val word = "dog"
           println("The translation of $word is ${word.inGerman}")
        }

        "cat".inGerman ---> compile error, method not found

* Built-in Singletons are also very convenient. Swap the word `class` for `object` and you get a singleton.

* The article left out lambdas. The function:

        fun greet(name: String, day: String): String {
            return "Hello $name, today is $day."
        }

        Can also be written as

        val greet = {name, day -> "Hello $name, today is $day."}

* The compiler is really smart in infering types. Extension values don't need type-specification, e.g.:

        val Double.km get() = this * 1000

* "when" in Kotlin doesn't need an argument, you can write arbitray rule-sets with it, with correctly inferred conditions:

        val myVar = when {
            stack.isEmpty() -> true
            x == null -> false
            currentIdx >= a && obj is MyType -> true   /* here x has been inferred to be not null from the previous branch! */
            else -> when {
                user.isPresent() -> calculateSomething()
                else -> throw IllegalStateException()
            }
        }

* sealed classes allow you to limit inheritance and get error when you miss something in a when

        /* you actually don't have to nest the classes this way, but you can */

        sealed class Expr {
           sealed class IntExpr : Expr {
              class Plus(val left: Int, val right: Int): IntExpr
              class Minus(val left: Int, val right: Int): IntExpr
           }

           sealed class StringExpr : Expr {
              class Substring(val str: String, val start: Int, val end: Int): StringExpr
           }
        }

        /* Usage: */
        val x: Expr
        when (x) {
           is Substring -> ...
           is Plus -> x.left + x.right

           /* compile error, we forgot to handle "Minus" from above */
        }

<comment><USER10> The receivers mechanism is kind of nice; reminds me of this[0], except that in Kotlin, everything is still statically typed. It's a really clean way to implement Trygve Reenskaug's DCI architecture.

[0] [http://www.p-cos.net/documents/contextl- soa.pdf](http://www.p-cos.net/documents/contextl-soa.pdf) (there was once an article called "ContextL : The Holy Grail of Business App Development", but this seems to be no longer available

</comment></comment><comment><USER71> Could someone tell me the meaning of _ in this Swift code:

        func greet(_ name: String,_ day: String) -> String {
            return "Hello \(name), today is \(day)."
        }
        greet("Bob", "Tuesday")

In me prior experience usually _ denoted an unused parameter/variable.

Also: I find the string interpolation syntax ugly... The syntax choices in Swift are curious, but not the most aesthetical/practical in my opinion.

<comment><USER47> Swift has both external and internal parameter names for functions. This is to make API design more readable, easier to parse through.

For example, you can have a function like so:

        func greet(with greeting: String, to personName: String) {
            print("\(greeting), \(personName)!")
        }

In the above code, "with" and "to" are external names, and are only available when calling the function but are not available inside the function itself. So you would call this function like so:

        greet(with: "Hello", to: "Bob")

Now if you want to exclude the external name to call the functions, you use the "_" syntax. So you're right that it denotes an unused parameter. In this case, it's an unused external parameter name.

<comment><USER72> Having never used Swift, it feels like the syntax is being optimized for the less-common case; are named parameters considered the "default" choice in Swift, and is using different external names so common that it's worth cluttering the syntax for functions without external parameters in order to make the their own syntax easier?

<comment><USER73> Named parameters are very much the default in Swift. Positional parameters are rare exceptions.

The internal/external name divide often works out beautifully. For example, let's equip Double with a multiply-add. An idiomatic Swift signature:

        extension Double {
          func multiply(by multiplier:Double, adding summand:Double) -> Double {
            return self * multiplier + summand
          }
        }

        print(3.multiply(by:4, adding:5))

Erase punctuation and you have:

        func multiply by multiplier adding summand

        print 3 multiply by 4 adding 5

The caller sees an action (multiply by, adding), the callee sees nouns (multiplier, summand). It's fantastically readable.

<comment><USER74> The javascript equivalent would be something like

        Number.prototype.multiply = function({by:multiplier, adding:summand = 0}) {
    	return this * multiplier + summand
        }

        console.log((3).multiply({by: 4, adding: 5}))

But of course, javascript APIs are hardly ever written like that. I think it's interesting how the norms of your ecosystem and very small differences in ergonomics in expression make a big difference in behaviour.

</comment></comment></comment></comment></comment><comment><USER75> Here in Ukraine it would be very hard to get adoption of a programming language that is named after a Russian military base. This is the rare case where bad naming choice really hurts. No matter how good is the language, you will have to hear and pronounce that name many times a day, and even associate yourself with it (e.g. "a Kotlin developer" in your resume). Not something to be taken lightly.

<comment><USER76> If they open source it, maybe someone should fork it called Kiev.

<comment><USER75> Ironically, the name "Kiev" would be no less offensive becuase this spelling of the name implies that this is a Russian city, not a Ukrainian one. The official and correct spelling is "Kyiv", see [http://kyiv.of- cour.se/](http://kyiv.of-cour.se/) for explanations why.

<comment><USER77> Ironically, the name "Kyiv" would also be no less offensive since it is written in Latin characters non native to Ukraine instead of the Ukrainian alphabet, which is a derivative of the Cyrillic alphabet. The official and correct spelling is "Київ"

<comment><USER75> Totally not. Many newly-installed signs in Kyiv are bilingual, in Ukrainian and in English. We have official rules for transliterating Cyrillic into Latin which the government uses.

</comment></comment></comment></comment></comment><comment><USER78> I don't get it. Kotlin was a clone of swift. So the title is wrong.

<comment><USER79> Kotlin was first released at least a couple of years before anyone outside of Apple had even heard of Swift.

<comment><USER78> Ah ok. Wikipedia says 2011.. Didn't hear about kotlin until a few months after swift was released

</comment></comment></comment><comment><USER80> Both of them are like javascript

</comment><comment><USER81> Kotlin would be unnecessary if Apple would do the work to interop/compile Swift both to the JVM ecosystem and the JavaScript one.

Unfortunately Apple's ambition on swift seems to have stalled.</comment>


Simple Affiliate Software For Web Apps/SaaS - <AUTHOR> http://flow.cloudomatic.com/

<comment><USER2> This is pretty sweet.

It's great to see companies springing up to take the hassle out of building SaaS apps.

Chargify/Recurly and the other folks doing recurring billing come to mind as well. Thanks guys!

<comment><USER3> Thanks! Infrastructure for distribution and monetization are really important for saas apps. The guys at chargify/recurly/spreedly/etc. are building some really important infrastructure too.

</comment></comment><comment><USER4> This. is. awesome.

And timely too. I was planning to sit down to add some affiliate stuff into MailFinch but I'd be willing to try this out. Just signed up for the beta.

</comment><comment><USER3> Hey, didn't expect this to get out to HN yet, but it did. We've been planning this for a while and have had some devs excited, but it's hard to really get people on board without something concrete. We put this together over the weekend as an MVP (im writing an entire post on it with andres this week).

Hopefully using Cappuccino too. Looking forward to feedback, since this is for developers and we need to make it work for you guys.

<comment><AUTHOR> Sorry, I've just been waiting for something like this for awhile. Really excited about it.

<comment><USER3> We're insanely excited an app developer submitted it :D.

</comment></comment></comment><comment><USER5> this is an incredibly complex task to pull off, best of luck guys. when will it be ready for testing?

<comment><USER6> This appears to be non existent, it uses a wufoo form... Has anyone ACTUALLY USED it?

<comment><USER3> It's an MVP, we're in the process of building it. We could either send mindless PDFs and talk about it or we could show it off. The screenshots are from the actual ui.

We're all about releasing products fast (cloudomatic and cloudomaticstart were released in <30 days). This isn't something done in a few weeks though sadly.

<comment><USER6> Not sure what MVP stands for... but I just hope you prove me wrong... Don't want to see a publictivity repeat.

<comment><USER3> MVP= minimum viable product.

</comment></comment></comment></comment></comment><comment><USER7> Great idea! On a side note, the hover effect on the buttons hurts my eyes - maybe it's just me.

<comment><USER3> Thank you! Ha, the green glow, right?

<comment><USER7> That's it! Looks like a developer took the initiative because apart from that the design is neat :D

</comment></comment></comment><comment><USER8> Pricing?

<comment><USER3> Still working out the exact details by talking to devs/getting feedback. Suggestions? Fyi, no up front fees or monthly minimums. ie- if you're starting out and want to use cloudomatic(flow), you don't have to be doing large volume.

<comment><USER9> This looks very promising. I believe that the number of people who want to offer affiliate marketing options will boom if you show them that you can do it (with your app). In a sense, you'd be creating a market. Perhaps offer fees that scale down (even minimally) as my revenue goes up, so that our interests are more fully aligned? And it may be worth experimenting with a monthly fee, just to see if that helps keep out the "high-maintenance, low-profit" customers (or not).

<comment><USER3> Thank you! It's a huge driver of revenue if done right. Our goal is to make it more customer/relevant partner driven, rather than shooting fish in the barrel traditional affiliate marketing. Yup, we'd definitely scale down with volume.</comment></comment></comment></comment>


Jolly Roger Telephone service and how I came to fight telemarketing - <AUTHOR> http://jollyrogertelephone.com/finally-a-realistic-plan-to-stop-unsolicited-telemarketing/ <comment><AUTHOR> ... the audio footage[0] of the conversation between his bot and the telemarketeer "trapped" is just insane. Hard to stop laughing but I also feel sorry for the caller :D

Hard to stop laughing:

[0] [https://s3-us-west-1.amazonaws.com/jollyrogertelephone- audio...](https://s3-us-west-1.amazonaws.com/jollyrogertelephone- audio/wav/727179d97a2e1f89b72efa37a00df928.wav)

Edit: typos

</comment><comment><USER2> This is quite similar to the "Lenny" Asterisk script that seems quite popular on Reddit: [https://www.reddit.com/r/itslenny/](https://www.reddit.com/r/itslenny/)

It seems that no real intelligence is required to keep telemarketers busy. A simple loop of generic answers can keep them occupied for >5min conversations.

</comment><comment><USER3> Amusing, but I don't believe that it can disrupt their business model as claimed. What percentage of people are going to set up these bots? Unless you get the entire population involved and it becomes a huge nationwide craze, the telemarketers are going to have very low odds of actually hitting a bot. So it will only raise their costs a little.

</comment><comment><USER4> Thank you! I will be subscribing shortly. But I'd like to take it a step further and actually setup a honeypot phone number so calls are automatically transferred to the bot without manual intervention.

My elderly parents were scammed this way and I want revenge!

</comment><comment><USER5> Extensive discussion of Jolly Roger's war against the "Windows Support" scam:

[https://news.ycombinator.com/item?id=13594840](https://news.ycombinator.com/item?id=13594840)</comment>


Looking for Developer Co-Founder for Big Idea - <AUTHOR>

I am an experienced business guy who has one failed startup under his belt but a lot of success as a finance guy.
I have a massive idea that i want to execute. My goal is to take the idea from concept to product to customers to demo at Techcrunch Disrupt in September.
I need a developer cofounder with experience building video platforms. But most importantly one who is passionate, hungry, extremely detail oriented and focused AND in NYC.
I am at TCDisrupt now and attending Hackers/Founders tomorrow. Any other good ideas about how i find a cofounder?
I hope this submission is not inappropriate for the board pls let me know and i will delete submission.
If anyone would like to contact
me feel free to email me at rockfile4@gmail
I have an office in manhattan and could help with some $ but this is really a cofounder not straight employee.
Thx
If this is inaproppriate for board someone tell me in comments and i will take down. <comment><USER2> Startuply.com OnStartups.com Craigslist.org Reddit & Digg Your local Startup community, Elance.com, etc.

Suggest being open with your Idea. Probably not as good as you think (I mean no harm by this but I have a ton of ideas, and right now they are not worth squat). Execution is key, which is my next question. I am the amazing, work my ass, I like your idea, lets talk shop, guy/gal (I am not but just for this exercise). What value are you, what can you do, done, talk is cheap, why should I get stoked about you? Past experience, will I trust you, like you, or are you a tool, scam, sham, whatever. What's your twitter? LinkedIN.

Get clear with all of this, and if you idea is solid enough find the skills yourself to make it happen. Talk to the TCDistrupt peeps. They know a hell of a lot more then me as I am speaking from what I think is the way.

Best of luck.

</comment><comment><USER3> It's not inappropriate for HN, but what would you contribute to this theoretical startup other than ideas?

As developers, we get pitches like this 5, 10, 20 or more times a week; I don't know too many people who are interested in jumping to work for an idea guy unless that idea guy can do sales, write code, do design, or otherwise contribute.

Hackers have lots of good ideas too, look at Google, Microsoft, Facebook, Apple, etc... All of those companies were created by hackers who happened to _also_ be idea guys; so just having the idea is not nearly enough.

Here's a good chance for you to work on your pitching skills ;)

<comment><AUTHOR> Very fair comment.

For starters i am a guy who has already had a very high level of success in another industry - investment banking -and while that industry isnt generating a lot of high fives at the moment, it is generally populated by high acheiving, smart, motivated people who know how to get things done. I am one of those people and succeeded at the highest levels generally working w small, growth companies on strategy, mergers and finance so i have some skills to bring to the table other than ideas.

Next, i am a good guy with vision and judgement and passion.

Finally, i have an office and will be committing all of my time to this idea AND i can help with $ if that makes sense.

This obviously only works if my cofounder is as passionate about the idea as i am so if you are at all interested get in touch!</comment></comment>


You can be a better blogger - <AUTHOR> https://www.dotdotdot.me/Grant-Ross/you-can-be-a-better-blogger

<comment><USER2> "For being a good writer, you certainly need to start reading a lot: here is a selection of texts to make the most out the writer in you.".

Really? Not "To be a good writer"? I laughed, assuming it's ironically clunky wording. The "you certainly" gives it a certain je ne sais quoi too, not to mention the missing "of".

As for the rest of the page, and the comments in this thread, I feel something may be going on that I don't understand.

</comment><comment><USER3> Am I supposed to read all this? Who curated it? How do I know its any good?

The thing is, if I want to be a better writer or blogger, there's already an ocean of advice at my disposal. And now there is even more.

These bookmarking/ content discovery apps are like dump trucks of information, and I wonder who has the time to actually read this stuff. Who is asking for all of this?

</comment><comment><USER4> I do certainly _hate_ this mentality on HN where every single time someone posts some new interesting webapp then someone comes to try to rain on the other person's parade.

This is simply not ok and goes totally against HN's mentality IMHO.

This "article" from 13 march 2013 is clearly an "answer" to the very recent new text editor for writers / proofreaders (where people can collaboratively work on the same text) that made it to the frontpage.

Please please please do not upvote this "article".

This is just a "contrarian" entry by a frustrated person trying to surf on the success of the recent new text editor for writers.

And by all means: please do try to enhance the tools we have and create new great webapps and do not pay attention to the frustrated contrarians.

<comment><AUTHOR> Hey Martin, not sure what you are talking about. The headline refers to an advice by Jason Fried on writing attitude. No offense, but please stay relaxed. Not even sure about which web app you are talking...</comment></comment>


The Mystical Mathematics of Rock and Roll - <AUTHOR> http://blogs.discovermagazine.com/fire-in-the-mind/2013/02/20/the-mystical-mathematics-of-rock-and-roll

<comment><USER2> Might be because I am tired, but what?

"Of course McDonald's restaurants are also sweeping the planet, and a recent post by British science writer Philip Ball on the BBC website suggests the jarring possibility that harmony may be something that is learned, not innate. "</comment>


SubList: Email subscriptions for blogs - <AUTHOR> https://sublist.io/

<comment> raving-richard So, this is like any of the WordPress email subscription plugins out there? [1] No wait, I'm wrong. You have to pay for this. And moreover, it quickly gets you to pay if you are successful at getting people to sign up ($10 a month for just 51 subscribers?!).

You might not be locked into the service ("Export emails anytime"), but still.

Conclusion, you don't need this service, unless you are a hipster too cool to run software on a server and so need to outsource any interaction with your readers. (Disques users anyone?[2]) Even then, this is an expensive service, the money could be better spent upgrading your shitty hosting service to actually allow you to run software on your (virtual) server...

[1] [https://duckduckgo.com/html/?q=wordpress+email+subscription+...](https://duckduckgo.com/html/?q=wordpress+email+subscription+plugin)

[2] Face the facts. Disques is a shit service for users and commentators. If you use it, you are doing everyone (and I mean everyone, except the Disques company and similar who make money off your anti-social actions) a disservice. Not only are you risking your the comments on your website (Disques might go bankrupt tomorrow), you are training people to be OK with using a centralized service. Moreover, you are contributing to the tracking of people across the web, and helping advertisers push their shit. The fact that you are cutting off people who don't, for whatever reason, have JavaScript enabled doesn't help your case. Please stop.

Edit: footnote 2 added. Edit 2: fixed spacing.

<comment><USER2> Unless your blog has some good traffic, it will probably take long time to reach 50 subscribers. It makes sense to spend your time writing more/better blog posts instead of engineering your blog.

Also, not all blogs are wordpress. I have two blogs. One of them is on medium and the other is custom written by me. I could use this app on the custom written one.

</comment></comment><comment><USER3> The little scroller example thingy is weird. I tried to click on the green button more than the blue button.</comment>


A Sales Lesson for Introverts - <AUTHOR> http://www.eliotdill.com/2012/11/sales-and-marketing-lesson-for-introverts/

<comment><USER2> Broken link.</comment>


TS80 Soldering Iron - <AUTHOR> https://vorpalhex.com/post/ts80-soldering-iron/ <comment><USER2> I hastily read the headline as "TRS-80," and as such was a little disappointed not to find an article about an unusually specific artifact of personal computer repair history, a la the famous Mac Cracker.

Still, it looks like a cool device! I might have to try one.</comment>


Why Concentration in the Banking Industry Threatens Our Economy - <AUTHOR> http://www.nakedcapitalism.com/2009/09/guest-post-why-concentration-in-the-banking-industry-threatens-our-economy.html <comment><USER2> I actually think _lack_ of Concentration in the Banking industry is a bigger problem ;)

</comment><comment><USER3> The problem with banking is the lack of regulation. See Canada as an example, we have 6 banks and no bailouts. The free-market does not work all the time and banks are not like other companies - as such, they should be heavily controlled by regulation to ensure stability and access to finance.

<comment><USER4> What specific regulations made the biggest difference?

The biggest factor I've read about is that Canada -- as a society and government -- never got on the "promote home ownership at all costs" bandwagon. There's no equivalent of Fannie and Freddie, and the traditional mortgage requirement of ~20% down remains. Thus Canada hasn't had the same sort of housing bubble, nor as many dubious mortgages, nor widespread mortgage securitization.</comment></comment>


Show HN: fflip.co – Stumbleupon for videos [flip through YouTube like it's TV] - <AUTHOR> http://www.fflip.co

<comment><USER2> That's pretty cool, the "flicking through TV" feel of the thing. You could consider pre-loading the second video though so it's a bit quicker...?

<comment><AUTHOR> Thanks! And that's a great idea

</comment></comment><comment><USER3> I really like that you start the videos in the middle of the clip rather than at the very beginning.

<comment><AUTHOR> Thank you, I usually judge a video by it's cover, so I thought it would be cool just to jump in partway and see.</comment></comment>


Show HN: Jobs for software developers delivered to your inbox - <AUTHOR> http://www.coderjobs.net/

<comment><USER2> I've already got jobs for software developers delivered to my inbox from the copious amount of recruiters emailing me... So incredibly annoying! I swear, they just spam every potential candidate for every job. The WORST!

<comment><USER3> One day you may reflect on this and realize this was a good problem to have.

<comment><USER4> Yeah, like when artificial intelligences enslave us all.

</comment></comment></comment><comment><USER5> I like the simplicity.

A few thoughts:

1\. Radius. My location is Olympia, WA (about an 60-90 minutes south of Seattle). Does that include Seattle jobs? It seems like that should be on a person-by-person basis. Some people here do commute into Seattle. For me, though, Seattle jobs would just be noise.

2\. Maybe another set of checkboxes for common technology stacks?

3\. I didn't receive a confirmation or verification email to confirm my signup. (Maybe it hasn't come yet)

Thanks, for those of us outside the big metro areas, this could be helpful.

</comment><comment><USER6> like the idea, although it is pretty much covered by many other job sites as they have this feature already.

Where are you sourcing the jobs from? This would be perfect if it aggregated jobs from all the other job sites. Searching for remote jobs (which I am interested in) in particular is a pain - and is actually why I signed up once I saw that was an option...

<comment><AUTHOR> yes, right now it is aggregated from job boards that i think are of high quality (github, stackoverflow, angellist, etc). but honestly, if you are living outside of tech hubs like SF, New York, Berlin etc, google is still your best bet to find jobs.

its a chicken and egg problem. i was recently looking for a job myself, in a small-ish city (200k people) in germany... and the job boards mentioned above were all completely useless. small companies in small cities don't post jobs in those job boards. its not worth it for them. posting a job at stackoverflow is something like 600 dollars.

i dont have an definite answer yet, all i know is, there must be a better way for finding jobs then google... right now i think i can offer this service, by just manually filling the system with high quality jobs matching all of my users critereas... someday i think this can be automated...

<comment><USER7> it would be great if the site had an about/imprint to know who's behind it

</comment></comment></comment><comment><USER8> I filled up the form. Here is what I see: [http://imgur.com/0B2dfRo](http://imgur.com/0B2dfRo)

<comment><AUTHOR> sorry, i got HN'd... i spun up another dyno at heroku to handle the traffic. please try again...

<comment><USER8> Nope...still the same result

</comment></comment></comment><comment><USER9> What is the search radius on this? Will I only get jobs for the specific location I enter?

It's a great start, and I hope you can continue to develop it. Being in Dallas I end up having to actively search out opportunities when I am looking, because the recruiters rarely come to me.

<comment><USER10> What sites are you searching? I built a web scraper to help automate my job search in NOLA

[http://nolatechjobs.leesome.com/](http://nolatechjobs.leesome.com/)

I'd be happy to share the code with you and you could switch out the sites I'm scraping with the ones you look at. The whole thing runs on a cronjob that just re-generates the HTML every hour.

<comment><USER9> Right now when I look I usually use Indeed and StackOverflow. I gave up on the big boys (Monster, CareerBuilder, Dice) because the sites are so polluted by recruiters and the filtering tools are so poor.

I'd love to try your scraper. I've thought about doing something like that before, particularly since I have started doing lots of web scraping for work and I am much more comfortable with it. Do you have any issues with sites that actively or passively discourage scrapers?

<comment><USER10> Nope, haven't run into any issues. I scrape Craigslist from RSS and the others from the HTML. I only hit the sites once an hour, and leave a unique browser string so they can filter me out of their analytics.

My e-mail is in my profile and I'll be happy to send over the code.

</comment></comment></comment></comment><comment><AUTHOR> so this is more or less an mvp to see if people find value in the idea. the idea grew out of my own frustration of how much job boards suck. if you are not living in SF finding a job as a software developer is far from a solved problem...

<comment><USER11> It isn't as hard in all areas - while I was in DC, I was getting ~3 emails a day from recruiters. I was able to score in person interviews in hours, even unsolicited at meetups.

Granted, in smaller places, getting a job in software engineering can be challenging, but it isn't too bad in many metropolitan locales, assuming you do the standard things software engineers should do to improve.

<comment><USER12> What do you mean by "assuming you do the standard things software engineers should do to improve"?

<comment><USER11> Always strive to improve yourself, learn new tech, set the example, etc. things any person should be doing with their career.

</comment></comment></comment></comment><comment><USER13> Would be much better if you could add multiple locations, but +1 for the concept ;-)

</comment><comment><USER14> Awesome... Have you thought about adding salary information to the site as well?

<comment><AUTHOR> great idea. I will add it to the roadmap. Also on the roadmap are other filters, like filter for specific technologies (PHP, Rails, Backbone, e.g)

</comment></comment><comment><USER15> If you could figure out how to keep those pesky recruiters out of my inbox, now there's a product!

</comment><comment><USER16> Keyword filtering!

Also: don't fail the form if I don't enter a location.

</comment><comment><USER17> I'd like to signup but still errors out after submitting the form.

<comment><USER18> You have to put a location apparently.

<comment><AUTHOR> no you shouldn't have too... the database seems to be the bootleneck. on my plan heroku limits concurrent connections to 20. just try to sign up again...again, sorry about that, i didn't carefully plan to be on the frontpage

</comment></comment></comment><comment><USER19> Where are you sourcing the jobs/gigs from?

<comment><AUTHOR> github, angel.co, stackoverflow right now. and manually based on interest...

<comment><USER20> can you add [https://www.wfh.io](https://www.wfh.io) to your list? :)

<comment><AUTHOR> sure, all links in this thread will be noted... any other links that haven't been mentioned yet?

</comment></comment></comment></comment><comment><USER21> No love for Security? :(

</comment><comment><USER22> What happens if you check both "Remote only" and "include remote"?

<comment><AUTHOR> my bad. that shouldn't be possible. check remote only, if you are just interested in jobs that allow remote work. check include remote if you are interested in both remote jobs and also jobs at your location. check none if you are only interested in jobs at your location. sorry about that...

<comment><USER7> sounds like three radios: remote, remote or office, office

<comment><USER23> or 2 checkboxes

remote, office

</comment></comment></comment></comment><comment><USER24> Consider RSS.</comment>