-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #1259 ### Summary of Changes Add a new kind of statement, the output statement, to inspect results of expressions without creating useless placeholders.
- Loading branch information
1 parent
a651ade
commit 011ba31
Showing
62 changed files
with
1,348 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# Statements | ||
|
||
Statements are used to run some action. Safe-DS has only two type of statements: | ||
Statements are used to run some action. Safe-DS only has three type of statements: | ||
|
||
- [Expression statements][expression-statements] evaluate an [expression][expressions] and discard any results. They are | ||
only useful if the expression has side effects, such as writing to a file. | ||
- [Assignments][assignments] also evaluate an [expression][expressions], but then store results in | ||
[placeholders][placeholders]. This allows reusing the results multiple times without having to recompute them. | ||
- [Output statements][output-statements] evaluate an [expression][expressions] as well, and provide options to inspect | ||
its results. Unlike when using assignments, the result cannot be reused. | ||
|
||
|
||
[assignments]: ./assignments.md | ||
[expression-statements]: ./expression-statements.md | ||
[assignments]: assignments.md | ||
[expression-statements]: expression-statements.md | ||
[output-statements]: output-statements.md | ||
[expressions]: ../expressions/README.md | ||
[placeholders]: ./assignments.md#declaring-placeholders | ||
[placeholders]: assignments.md#declaring-placeholders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Output Statements | ||
|
||
Output statements are used to evaluate an expression and inspect its results. Unlike when using assignments, the results | ||
cannot be reused. However, it is also not necessary to think of unique names for placeholders, which saves time and | ||
keeps the namespace clean. | ||
|
||
The next snippet shows how the singular result of an expression (the loaded | ||
[`Table`][safeds.data.tabular.containers.Table]) can be inspected: | ||
|
||
```sds | ||
out Table.fromCsvFile("titanic.csv"); | ||
``` | ||
|
||
This output statement has the following syntactic elements: | ||
|
||
- The keyword `#!sds out`, which indicates that we want to inspect the results of an expression. | ||
- The expression to evaluate. | ||
- A semicolon at the end. | ||
|
||
Inspecting values requires a working installation of the [Safe-DS Runner][runner]. Follow the instructions in the | ||
[installation guide][installation] to install it. Afterward, you can inspect values of various types via | ||
_code lenses_ in the editor, as explained for [assignments][value-inspection]. | ||
|
||
[installation]: ../../getting-started/installation.md | ||
[runner]: https://github.com/Safe-DS/Runner | ||
[value-inspection]: assignments.md#inspecting-placeholder-values-in-vs-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const COMMAND_EXPLORE_TABLE = 'safe-ds.exploreTable'; | ||
export const COMMAND_PRINT_VALUE = 'safe-ds.printValue'; | ||
export const COMMAND_RUN_PIPELINE = 'safe-ds.runPipeline'; | ||
export const COMMAND_SHOW_IMAGE = 'safe-ds.showImage'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.