@brightball Go has had first class support for cross compilation for a while now, no?
Comparing Elixir and Go
31–40 of 202 posts
Re: Comparing Elixir and Go
#32> The biggest difference between the two languages is that compilation for the destination architecture has to be done on that same architecture. The documents include several workarounds for this scenario, but the simplest method is to build your release within a Docker container that has the destination architecture. @brightball Go has had first class support for cross compilation for a while now, no?
Re: Comparing Elixir and Go
#33The other trade-off that comes from mutable versus immutable data comes from clustering. With Go, you have the ability to make remote procedure calls very seamlessly if you want to implement them, but because of pointers and shared memory, if you call a method on another box with an argument that references to something on your machine, it can’t be expected to function the same way. I would be happy to know how we ca…
Never used it, but lots of people in conferences are happy with it.
Re: Comparing Elixir and Go
#34Earlier quoted context omitted.
Have you ever worked in telecom industry? I did, at one of the the companies you list there. We had outsourced and offshored code for modules on those switches you mentioned. Have you ever had the pleasure to review C++ code in such type of projects? I did, and hope to never do it again.
Remember any specific examples/patterns? Curious to see how bad it could be...
- Code either "C code compiled with C++ compiler" or C++ OOP Spaghetti like in the CORBA/DCOM days before JEE was a thing.
- functions/methods that span several screens
- barely any kind of testing
- due to emphasis on C style programming, lots of fun tracking down pointer misuses
- re-implementation of code that is already part of C++ standard library, even the ones from C
- lots of copy-paste on the same file because devs don't understand neither source control nor modularity
Re: Comparing Elixir and Go
#35Author here. This was published a week earlier than expected so just a heads up that there are a couple of edits coming.
Small typo I found: """Go channels implement buffers which can either receive a a certain number of messages"""
(2x a)
Re: Comparing Elixir and Go
#36Re: Comparing Elixir and Go
#37Re: Comparing Elixir and Go
#38Author here. This was published a week earlier than expected so just a heads up that there are a couple of edits coming.
Go methods have to be defined in the same package as their receiver's type. As a result, you can only add methods to your own types, not someone else's.
Also, the article claims that Go interfaces are similar to Elixir's pattern matching but I don't see a resemblance. Perhaps clarify that?
Re: Comparing Elixir and Go
#39Go multitasking is based on the compiler inserting switchpoints on function calls and syscall boundaries. But this affects the scheduling of a single OS-level threads executing that specific goroutine. The number of OS-level threads that the Go scheduler uses can arbitrarily grow, and OS-level threads are preemptively multitasked.
So I think the description is focusing a narrow view of the problem. What is usually required by applications is low latency in reply to system events (e.g.: data available on network sockets), and Go performs very well in this context. For instance, the fact that Go is transparently using a epoll/kqueue based architecture under the hood is probably affecting latency much more than the whole "cooperative" issue as depicted.
Re: Comparing Elixir and Go
#40> Within Elixir, there is no operator overloading, which can seem confusing at first if you want to use a + to concatenate two strings. In Elixir you would use instead.
When this popped up, it reminded me of something people try to do often and then have issues with performance. You probably do not want to concatenate strings.
"Yes I do" you'll first think, but actually erlang has a neat commonly used thing to help here.
Let's say you're doing some templating on a web-page. You want to return "Welcome back username!". First pass (a while since I wrote erlang so forgive syntax errors):
welcome(Username) ->
"Welcome back " ++ Username ++ "!"
Now it's going to have to construct each string, then create a new string with all three. More creation & copying means things get slower.Instead, many of the functions you'd use to write files or return things over a connection will let you pass in a list of strings instead.
welcome(Username) ->
["Welcome back ", Username, "!"]
Now it's not copying things, which is good. But then we want to put the welcome message into another block with their unread messages. full_greeting(Username) ->
welcome(Username) ++ unread_messages()
More appending than is good here, concatenating lists is going to take time. Of course, we could put it all in one function, but then we lose re-usability in the templates and have horrible massive functions. While this is a simple example, I hope you can picture a larger case where you'd want to split up the various sections.Anyway, there's a better way of doing this. The functions that take lists of strings actually take lists of strings or other lists. So we can just do this:
full_greeting(Username) ->
[welcome(Username), unread_messages()]
You can keep going, nesting this as much as you want. This saves a lot of copying, allows you to split things up and avoids having to keep flattening a structure.So, for people about to get started, try not to concatenate your strings, you can probably save yourself and your computer some time.
For more info on this, you want to search for "IO Lists" or "Deep IO Lists".