Skip to content

Commit

Permalink
Merge e64b286 into 7c15768
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Oct 12, 2018
2 parents 7c15768 + e64b286 commit ba46bba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/src/style.md
Expand Up @@ -180,6 +180,21 @@ end
public_function(x) = internal_function(x)
```

#### `@enum` vs. `Symbol`

The `@enum` macro lets you define types with a finite number of values that
are explicitly enumerated (like `enum` in C/C++). `Symbol`s are lightweight
strings that are used to represent identifiers in Julia (for example, `:x`).

`@enum` provides type safety and can have docstrings attached to explain the
possible values. Use `@enum`s when applicable, e.g., for reporting statuses.
Use strings to provide long-form additional information like error messages.

Use of `Symbol` should typically be reserved for identifiers, e.g, for lookup
in the JuMP model (`model[:my_variable]`).



Design principles
-----------------

Expand Down

0 comments on commit ba46bba

Please sign in to comment.