“abstract out” the errors, and argued that the program should be divided into “pure” code and code which “fixes the errors.” – Joe Armstrong Tuesday, February 28, 12
message.split() if len(split_message) == 3: a, operator, b = split_message if a.isdigit() and b.isdigit(): result = int(a) + int(b) return result Tuesday, February 28, 12
message.split() if len(split_message) == 3: a, operator, b = split_message if a.isdigit() and b.isdigit(): result = int(a) + int(b) return result Tuesday, February 28, 12
an exception % you can cause exceptions manually: exit(Pid, Reason). % or they will be raised for you: add(A,B) -> A + B. add(foo, 2). % {'EXIT',{badarith,[{intro,add,2}, ... Tuesday, February 28, 12
receive an exit signal and exit % if the exit message is the atom ‘normal’ % the linked processes will not exit exit(normal). % we can stop linked processes from exiting % by setting the trap_exit process flag process_flag(trap_exit, true). Tuesday, February 28, 12
receive an exit signal and exit % if the exit message is the atom ‘normal’ % the linked processes will not exit exit(normal). % we can stop linked processes from exiting % by setting the trap_exit process flag process_flag(trap_exit, true). % we can override trap_exit by setting the % exit message to the atom ‘kill’ exit(kill). Tuesday, February 28, 12
Function, Args} Restart, % atom ‘permanent’, ‘transient’ or ‘temporary’ Shutdown, % atom ‘brutal_kill’, ‘infinity’ or an integer Type, Modules } Tuesday, February 28, 12
Function, Args} Restart, % atom ‘permanent’, ‘transient’ or ‘temporary’ Shutdown, % atom ‘brutal_kill’, ‘infinity’ or an integer Type, % atom ‘worker’ or ‘supervisor’ Modules } Tuesday, February 28, 12
Function, Args} Restart, % atom ‘permanent’, ‘transient’ or ‘temporary’ Shutdown, % atom ‘brutal_kill’, ‘infinity’ or an integer Type, % atom ‘worker’ or ‘supervisor’ Modules % list of used modules } Tuesday, February 28, 12
Function, Args} Restart, % atom ‘permanent’, ‘transient’ or ‘temporary’ Shutdown, % atom ‘brutal_kill’, ‘infinity’ or an integer Type, % atom ‘worker’ or ‘supervisor’ Modules % list of used modules } Tuesday, February 28, 12