[erlang-questions] node.js vs erlang

Leonard Boyce leonard.boyce@REDACTED
Fri Jun 20 16:47:46 CEST 2014

On Fri, Jun 20, 2014 at 9:06 AM, Loïc Hoguin <essen@REDACTED> wrote:
> I mean what.

It's not a holy war :) This thread has been going for quite a while
and unfortunately for a time warped into a 'cowboy complexity
criticism thread'.
All I'm trying to do is add to the conversation by providing anecdotal
evidence on pain points for those new to Erlang.
I believe there is always value in examining the opinions and
statements of others as they allow us to find ways to possibly

> On 06/20/2014 02:54 PM, Leonard Boyce wrote:
>> 2) "What the hell is with the crazy 'defacto' indentation. I don't use
>> or want to learn to use emacs, I'm perfectly happy with Sublime."
> Why the hell are they not using Sublime? What's this 'defacto' indentation
> thing you mention? Most people write Erlang in their favorite editor. I use
> vim without any plugins myself.

They are using Sublime as that's their editor of choice.
When I started learning Erlang I was informed that the 'defacto'
standard for indentation is the indentation used by elang mode for
emacs as this was the primary erlang editor. Maybe I was misinformed,
but that became our coding standard. Others developers use emacs or
ElrIDE (which uses the same indentation as emacs). No other 'popular'
editor correctly supports the 'emacs style' indentation for Erlang.
Maybe it's just me but I like consistency and my mind is 'trained' to
match this indentation format.

>> 3) "TDD is extremely painful. What should I be writing tests for?"
> If it's painful then they're not doing it right. They should write tests for
> exactly the things they test manually. Doesn't need to be more than that at
> the beginning, tests can get added over time.

Thank you. This is something which is not really covered as an "Erlang
best practice" in anything I've seen to date. My guys want to write
tests for every possible return from every single function. I'm even
seeing tests which are actually testing returns from OTP function

If anyone knows of any resources for "Best Practices" for erlang
testing I'd appreciate their sharing.

>> 5) "No unicode aware/safe string library? wtf? Lists of integers?
>> Binaries? Why in deities name does it have to be so convoluted?"
> I'm not sure why they would say that. It's not like JS has good Unicode
> support either. Erlang has a number of ICU bindings available if you do need
> Unicode though.

Again, they're learning and it's a process. In our main project we use
the "ux" library.
But I understand their befuddlement. It just "seems" like something a
language should include.
Seeing the movement over the versions with unicode support I guess
that eventually it may exist.

>> 7) "Dialyzer is dog slow"
> Is it? Are they rebuilding the PLT all the time? It never takes more than
> 10s to dialyze for me on the bigger projects (usually < 2s though). Much
> faster than running tests (especially running tests by hand if that's what
> they'd prefer doing).

Confession time, I just blindly believed that when I was told. Turns
out they missed reading the "0." in seconds in the timer. His simple
build time was 0m0.45

On the other hand, your pointing this out led me to investigate our
main project makefile. Here it currently takes ~ 15 minutes to run and
basically uses 100% memory and forces swapping.

Maybe someone smarter can point out the error as I certainly cannot see it :(

### snip from Makefile (assume correctly tab indented)
## Dialyzer
.PHONY: dialyzer

  -dialyzer --output_plt $(OTP_PLT) --build_plt \
    --apps erts kernel stdlib crypto public_key mnesia ssl xmerl inets
  -dialyzer --output_plt $(DEPSOLVER_PLT) --build_plt \
    --apps -r deps

dialyzer: $(DEPSOLVER_PLT)
  nice -19 \
   dialyzer apps/*/ebin/ --plts $(OTP_PLT) $(DEPSOLVER_PLT) \
     -Wrace_conditions \
     -Wunmatched_returns \
### end snip

>> 8) "What's up with the documentation organization? Why do I have to
>> use google to be able to find anything in the official docs?
>> Navigating the docs is crazy, I feel like it's still 1998"
> ???
> http://www.erlang.org/erldoc

And yet the 1st documentation link on http://www.erlang.org/doc.html
(the title "Erlang/OTP documentation")  is to the *non* searchable
version http://www.erlang.org/doc/.
Yes, right in that paragraph is a link to the searchable version, but
if they already have the link to what they're looking for, why would
they even bother reading that paragraph.
Additionally, google search results invariably link to the *non*
searchable documentation.

Maybe changing the link on the paragraph title and explicitly listing
links to both types of documentation in the paragraph body would
prevent this 'mistake'.
I know I made that mistake myself. I was totally unaware the
searchable docs existed.

> It sounds a lot like you/they're making their life harder than it should be.

That could well be the case, and this is why I believe such
discussions are useful as I want to make life easier for all.

Thanks for the response,

> --
> Loïc Hoguin
> http://ninenines.eu

More information about the erlang-questions mailing list