Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
buildsupport
Commits
155f6c5d
Commit
155f6c5d
authored
Apr 03, 2017
by
Maxime Perrotin
Browse files
Remove direct access to value of option type
parent
7defe3c3
Changes
1
Show whitespace changes
Inline
Side-by-side
ada/option_type.ads
View file @
155f6c5d
...
@@ -8,8 +8,8 @@ package Option_Type is
...
@@ -8,8 +8,8 @@ package Option_Type is
type
Option
is
tagged
private
;
type
Option
is
tagged
private
;
function
Just
(
I
:
T
)
return
Option
;
function
Just
(
I
:
T
)
return
Option
;
function
Nothing
return
Option
;
function
Nothing
return
Option
;
function
Just
(
O
:
Option
)
return
T
;
--
function Just (O : Option) return T;
function
Value
(
O
:
Option
)
return
T
renames
Just
;
--
function Value (O : Option) return T renames Just;
function
Value_Or
(
O
:
Option
;
Default
:
T
)
return
T
;
function
Value_Or
(
O
:
Option
;
Default
:
T
)
return
T
;
function
Has_Value
(
O
:
Option
)
return
Boolean
;
function
Has_Value
(
O
:
Option
)
return
Boolean
;
...
@@ -27,7 +27,7 @@ private
...
@@ -27,7 +27,7 @@ private
function
Nothing
return
Option
is
function
Nothing
return
Option
is
(
Present
=>
False
,
others
=>
<>
);
(
Present
=>
False
,
others
=>
<>
);
function
Just
(
O
:
Option
)
return
T
is
(
O
.
Value
);
--
function Just (O : Option) return T is (O.Value);
function
Value_Or
(
O
:
Option
;
Default
:
T
)
return
T
is
function
Value_Or
(
O
:
Option
;
Default
:
T
)
return
T
is
(
if
O
.
Present
then
O
.
Value
else
Default
);
(
if
O
.
Present
then
O
.
Value
else
Default
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment