diff options
author | Loïc Hoguin <[email protected]> | 2016-08-29 12:39:49 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-29 12:40:03 +0200 |
commit | c807880f7ac73f813b2660ea81a00f7712a4e793 (patch) | |
tree | ba1d09e9b177f230665a80513b33fbd532000ce4 /archives/extend/2015-October.txt | |
parent | b1df25a7d9cda697513650659b781b55b40898f8 (diff) | |
download | ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.gz ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.bz2 ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.zip |
Add old mailing list archives
Diffstat (limited to 'archives/extend/2015-October.txt')
-rw-r--r-- | archives/extend/2015-October.txt | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/archives/extend/2015-October.txt b/archives/extend/2015-October.txt new file mode 100644 index 00000000..53f718ed --- /dev/null +++ b/archives/extend/2015-October.txt @@ -0,0 +1,80 @@ +From ivan at llaisdy.com Tue Oct 20 15:19:05 2015 +From: ivan at llaisdy.com (Ivan Uemlianin) +Date: Tue, 20 Oct 2015 14:19:05 +0100 +Subject: [99s-extend] Cowboy: Maps instead of records for context variables +Message-ID: <[email protected]> + +Dear All + +Would there be any reason against using a map instead of a record for +the context variable in a Cowboy REST resource? + +Quite often I have a few resources doing very similar things in their +callbacks, and I'd like to abstract out the similarities into a module - +but I don't want to share a record between modules. + +Maps seem to be a good fit, and I can't think of any downside +(performance hit should be tiny). + +Can anyone give me reasons to stick with records? + +With thanks and best wishes + +Ivan + + +-- +============================================================ +Ivan A. Uemlianin PhD +Llaisdy +Speech Technology Research and Development + + ivan at llaisdy.com + @llaisdy + llaisdy.wordpress.com + github.com/llaisdy + www.linkedin.com/in/ivanuemlianin + + festina lente +============================================================ + + +From essen at ninenines.eu Tue Oct 20 15:22:39 2015 +From: essen at ninenines.eu (=?UTF-8?Q?Lo=c3=afc_Hoguin?=) +Date: Tue, 20 Oct 2015 15:22:39 +0200 +Subject: [99s-extend] Cowboy: Maps instead of records for context + variables +In-Reply-To: <[email protected]> +References: <[email protected]> +Message-ID: <[email protected]> + +On 10/20/2015 03:19 PM, Ivan Uemlianin wrote: +> Dear All +> +> Would there be any reason against using a map instead of a record for +> the context variable in a Cowboy REST resource? +> +> Quite often I have a few resources doing very similar things in their +> callbacks, and I'd like to abstract out the similarities into a module - +> but I don't want to share a record between modules. +> +> Maps seem to be a good fit, and I can't think of any downside +> (performance hit should be tiny). +> +> Can anyone give me reasons to stick with records? + +The only reason to use records is to keep typespecs information to +improve Dialyzer's error reporting. + +Personally I have no problems going with just maps for all kinds of +states, even if they are in the same module. This is partly because I +rely a lot more on tests than on Dialyzer to tell me my program is wrong. + +Cheers, + +-- +Lo?c Hoguin +http://ninenines.eu +Author of The Erlanger Playbook, +A book about software development using Erlang + |