[erlang-questions] atoms used as status info, 'constants' etc

Mingyan Wang mingyan.wang@REDACTED
Tue Aug 18 09:50:28 CEST 2009


 Sorry for mistake.

The following should be correct. 
-define(status_a,status_a).



-----Original Message-----
From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Mingyan Wang
Sent: 2009年8月18日 15:38
To: Dave Pawson; Erlang Questions
Subject: RE: [erlang-questions] atoms used as status info, 'constants' etc

Hi Dave,

Define the constants in a hrl file.
E.g.
-define(status_a,"status_a").

Include this hrl file in your erl file and then you can use this syntax ?status_a.
E.g.
case Status of
 ?status_a ->
......

 

-----Original Message-----
From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Dave Pawson
Sent: 2009年8月18日 15:27
To: Erlang Questions
Subject: [erlang-questions] atoms used as status info, 'constants' etc

I'm using atoms as status value returns from functions.
Is there any 'best practice' in this area?
  In other languages I might keep them together as defined constants or some such?

TIA

--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org



More information about the erlang-questions mailing list