# Potential Incompatibilities

> This document contains a list of all potential incompatibilities between Erlang 5.4/OTP R10B and the previous version Erlang 5.3/OTP R9C, and is an extract from the release notes for the respective applications.

## Compiler

- The semantics for boolean operators in guards have been changed to be more consistent.
  All boolean operators will fail if given non-boolean arguments; '`true or garbage`' used to succeed but will now fail. Also, failure in the evaluation of the operands will also cause the guard to fail; '`true or element(1, [])`' used to succeed but will now fail.
  Semicolon will behave as it used to. If a failure as described above occurs, evaluation will continue with the right operand of the semicolon.
  (Own Id: OTP-4623)
- The unary '+' operator has been changed to throw an 'badarith' exception if its argument is not numeric (or fail in a guard). It used its argument unchanged whatever the type. Given the new meaning, unary '+' can now be used to test whether a term is numeric.
  (Own Id: OTP-4928)

## Erl_Interface

- Process identifiers and port identifiers have been made more unique. Previously 18 bits were used as id in the internal representation of process and port identifiers. Now 28 bits are used.
  The maximum limit on the number of concurrently existing processes due to the representation of pids has been increased to 268435456 processes. The same is true for ports. This limit will at least on a 32-bit architecture be impossible to reach due to memory shortage.
  NOTE: By default, the `ERTS`, and the `erl_interface`, `ei`, and `jinterface` libraries are now only guaranteed to be compatible with other Erlang/OTP components from the same release. It is possible to set each component in compatibility mode of an earlier release, though. See the documentation for respective component on how to set it in compatibility mode.
  (Own Id: OTP-4968 Aux Id: OTP-4196)

## ERTS

- Guards of mach specifications are corrected to resemble the semantics of guards in real code more closely. The implementation now corresponds to the documentation in erts users guide. The following things are corrected:
  - Guard sematics was wrong when it came to logical operators and exceptions. {'or', {'is_integer','$1'}, {'or', '$1', '$1'}} evaluated to true with '$1' bound to an integer.
  - Unary + and - was not implemented
  - Calling operators as Bif's was not supported by ets/dbg:fun2ms (erlang:'or'(A,B) etc)
  - Old typetests (like integer(X) instead of is_integer(X)) was not supported by ets/dbg:fun2ms
  - Semicolon (;) in guards was not supported by ets/dbg:fun2ms
  (Own Id: OTP-4927)
- The match spec parse transform `ms_transform` no longer accepts the `andalso` and `orelse` constructs in guards for consistency with the standard Erlang language. A future release of Erlang/OTP may allow `andalso` and `orelse` in guards.
  (Own Id: OTP-5149)
- `erlang:system_monitor/2` no longer sends any monitoring messages to the system monitor process from itself. This behavior is more consistent with other trace functionality.
  (Own Id: OTP-5183)
- The unary '+' operator has been changed to throw an 'badarith' exception if its argument is not numeric (or fail in a guard). It used its argument unchanged whatever the type. Given the new meaning, unary '+' can now be used to test whether a term is numeric.
  (Own Id: OTP-4928)
- Process identifiers and port identifiers have been made more unique. Previously 18 bits were used as id in the internal representation of process and port identifiers. Now 28 bits are used.
  The maximum limit on the number of concurrently existing processes due to the representation of pids has been increased to 268435456 processes. The same is true for ports. This limit will at least on a 32-bit architecture be impossible to reach due to memory shortage.
  NOTE: By default, the `ERTS`, and the `erl_interface`, `ei`, and `jinterface` libraries are now only guaranteed to be compatible with other Erlang/OTP components from the same release. It is possible to set each component in compatibility mode of an earlier release, though. See the documentation for respective component on how to set it in compatibility mode.
  (Own Id: OTP-4968 Aux Id: OTP-4196)
- The exception code for calling a fun with wrong number of arguments has been changed from simply `badarity` to `{badarity,{Fun,Args}}`.
  (Own Id: OTP-5139)

## Ic

- The compile otion `multiple_be` is no longer supported.
  (Own Id: OTP-5049)

## Inets

- A HTTP 1.1 client is officially included in inets. It is loosely based on the previously unsupported code contributed by Johan Blom. In this first version only the most basic HTTP functionality is supported. The user API has been changed.
  (Own Id: OTP-5047)
- Due to several possibilities to interpret the ftp standard some newer ftp-servers have interpreted the standard in such a way that the documented return value of ftp:nlist/2 does not always match the actual return value. Some extra checks have now been added to ensure the documented return value. This will also result in that ftp:nlist is not bug compatible in the case that nlist is given a filename instead of a directory it will now return an error instead of {ok, FileName}.
  (Own Id: OTP-5165)

## Jinterface

- `OtpMbox.receive()` and `OtpMbox.receive(long timeout)` can now throw `OtpErlangDecodeException` if the received message can not be decoded. `null` is now only returned from `OtpMbox.receive(long timeout)` if a timeout occurs. `OtpMbox.receive()` will never return `null`.
  (Own Id: OTP-3932 Aux Id: seq5196)
- Process identifiers and port identifiers have been made more unique. Previously 18 bits were used as id in the internal representation of process and port identifiers. Now 28 bits are used.
  The maximum limit on the number of concurrently existing processes due to the representation of pids has been increased to 268435456 processes. The same is true for ports. This limit will at least on a 32-bit architecture be impossible to reach due to memory shortage.
  NOTE: By default, the `ERTS`, and the `erl_interface`, `ei`, and `jinterface` libraries are now only guaranteed to be compatible with other Erlang/OTP components from the same release. It is possible to set each component in compatibility mode of an earlier release, though. See the documentation for respective component on how to set it in compatibility mode.
  (Own Id: OTP-4968 Aux Id: OTP-4196)

## Kernel

- Native lookup (system calls) is now default resolver method on all platforms. Also the user inet configuration method has changed so that a kernel variable, inetrc, should now be used to specify the name of the user inet config file (if it exists). This is all documented in the ERTS User's Guide.
  (Own Id: OTP-4983)
- The code server could hang if invoked early in the startup. For example if the emulator was started with "-s file eval Filename" and Filename contained a call to code:add_patha/1 the code server accidentally tried to execute code in an unloaded module from inside the code that loaded a module - hence hangup. This bug has now been fixed.
  Note! Starting erlang through code loading from a remote erlang boot server will not work after this patch. It will be fixed in a later patch. Rumours has it that remote boot server code loading did not work before this patch either. It is not a commonly used feature.
  (Own Id: OTP-4802 Aux Id: seq8314)

## Megaco

- Text parser did not handle auditReturnItem properly, as defined in IGv11. The result which was supposed to have been presented as the tuple: `{emptyDescriptor, #'AuditDescriptor{}}` in the termination audit list, was instead entered as `{auditReturnItem, atom()}` in the termination audit list. This has been fixed.
  (Own Id: OTP-4950)
- signalsDescriptor has changed i v2
- ServiceChangeProfile has changed in v2

## Odbc

- The old interface that became deprecated in odbc 1.0 has now been removed.
  (Own Id: OTP-4794)
- SQL_NUMERIC and SQL_DECIMAL columns are converted to integer and float values if possible.
  (Own Id: OTP-4826)
- Result sets are now by default returned as a list of tuples which is the most intuitive and useful mapping. To keep some degree of backwards compatibility you may turn this off to get the old behavior that result sets are returned as lists of lists. However do not use this in new code as it is considered a deprecated feature that eventually will disappear.
  (Own Id: OTP-4850)

## Orber

- The work-around introduced in version 3.4.1 (OTP-4608) has now been removed. Make sure you are using IC-4.2 or later.
- Since the OMG has defined a default port number (2809), Orber no longer support the boostrap port.
  (Own id: OTP-5005)

## Sasl

- When doing a code replacement in run-time, updating the internal state of a gen_server, gen_event or gen_fsm, it was stated in the documentation that the first argument `OldVsn` to the callback function `Module:code_change` was defined by the `vsn` attribute in the old version of `Module`.
  However, this was not true. For downgrades, `OldVsn` was `{down,Vsn}`, where `Vsn` was fetched from the `.app` file instead.
  The version is now always fetched from the module using `beam_lib:version/1` and the man pages for gen_* have been updated accordingly.
  (Own Id: OTP-3699)
- The release handling instruction `restart_application` was translated to the low-level instruction `application_remove` and a set of `load_module` instructions.
  However, `application_remove` caused the modules listed for the new, not the old, version of the application to be unloaded. If the set of modules was changed, this meant the release handler would try to purge non-existant modules and/or forget to unload modules no longer used.
  `restart_application` is now translated to a correct set of `delete_module` and `add_module` instructions instead, and the `application_remove` instruction is deprecated.
  (Own Id: OTP-4805)
- `release_handler:check_install_release/1` returned `{error,Reason}` if `sys.config` or `relup` was missing. Since both these files are optional, the behaviour has been changed to write warnings to the terminal but return an `ok` tuple instead.
  (Own Id: OTP-4824)

## Snmp

- New sys configuration format. Allthough the old configuration format still works (if only the agent is used), it is no longer documented and will eventually be eliminated. See application configuration or configuration params for more info.
- Three new interface modules have been introduced. One for each of the individual parts of the application:
  - [agent] `snmpa`
  - [manager] `snmpm`
  - [compiler] `snmpc`
  The primary interface module, `snmp`, still exist. It contains the application generic functions. The agent specific stuff still exist (for backward compatibillity reasons), but has been deprecated and will eventually be removed.
  Some previously already deprecated functions has been removed (since they in turn was dependent on deprecated functions, see calendar).
- [agent] The agent network interface api has changed. See snmp agent net if,
- [agent] The default agent audit trail log name has changed.
- [compiler] Mib format has changed (see OTP-5053 above).

## Stdlib

- Guards of mach specifications are corrected to resemble the semantics of guards in real code more closely. The implementation now corresponds to the documentation in erts users guide. The following things are corrected:
  - Guard sematics was wrong when it came to logical operators and exceptions. {'or', {'is_integer','$1'}, {'or', '$1', '$1'}} evaluated to true with '$1' bound to an integer.
  - Unary + and - was not implemented
  - Calling operators as Bif's was not supported by ets/dbg:fun2ms (erlang:'or'(A,B) etc)
  - Old typetests (like integer(X) instead of is_integer(X)) was not supported by ets/dbg:fun2ms
  - Semicolon (;) in guards was not supported by ets/dbg:fun2ms
  (Own Id: OTP-4927)
- Some support for records has been added to the Erlang shell. There are commands for reading record definitions from files and for manipulating record definitions in the shell. The record syntax can be used in the shell and return values are printed as records when possible using the records definitions known to the shell. New commands in the shell are `rd/2`, `rf/0,1`, `rl/0,1`, `rp/1`, and `rr/1,2,3`. Existing functions in `user_default.erl` with any of these names need to be renamed. See `shell(3)` for further details.
  (Own Id: OTP-5063)
- `gen_server:cast/2` now crashes for invalid arguments.
  `gen_server:abcast/2-3` now crashes for invalid arguments. The behaviour when casting to the name `global` has been corrected. Previously, `gen_server:abcast(global,[node@host])` tried to cast to the globally registered name `node@host`, which is more of a bug than less. Now such a call will cast to the registered name `global` at the node `node@host` as (probably) expected.
  An `rpc:call/5` and `rpc:block_call/5` having a timeout argument has been added.
  `rpc:abcast/2-3` has been improved not to get stuck waiting for connection setup if the remote node is not connected. In this case the send is spawned off to a temporary process.
  Two typos in the docs for module `calendar` has been corrected thanks to Bengt Kleberg.
  (Own Id: OTP-4844 Aux Id: seq8226)
- The code server could hang if invoked early in the startup. For example if the emulator was started with "-s file eval Filename" and Filename contained a call to code:add_patha/1 the code server accidentally tried to execute code in an unloaded module from inside the code that loaded a module - hence hangup. This bug has now been fixed.
  Note! Starting erlang through code loading from a remote erlang boot server will not work after this patch. It will be fixed in a later patch. Rumours has it that remote boot server code loading did not work before this patch either. It is not a commonly used feature.
  (Own Id: OTP-4802 Aux Id: seq8314)

## Webtool

- If `Data` is set to `PortNumber` in `start(Path,Data)`, the default data will be used for ip-number (`127.0.0.1`) and server name (`localhost`).
  (Own Id: OTP-4724)