Record selectors (again)

Vance Shipley vances@REDACTED
Tue Jun 22 20:50:45 CEST 2004


On Tue, Jun 22, 2004 at 06:27:21PM +0200, Kostis Sagonas wrote:
}  -module(rec).
}  -export([unsafely_access_a/1]).
}  -record(rec,{a,b}).
}  
}  unsafely_access_a(R) ->
}      R#rec.a.

It seems to me that it's up to you to test if the argument is 
correct or not.  Otherwise it is handled through exception handling
(i.e. you may want it to crash).

unsafely_access_a(R) when is_record(R, rec) ->
	R#rec.a.



	-Vance



More information about the erlang-questions mailing list