Comments (6)
conditions are not part of duckscript. they are commands on their own.
it has its limitations but also extendibility where the main goal was to be super super simple lang with nothing in it just simple 1 liner syntax.
so i agree it can make things simpler, it is also not that clear where not ends and make things more complex at same time.
from duckscript.
Besides,
not false and false
gives true
is a little confusing... Although I can kind of understand it.
from duckscript.
Hmmm, but why
# Unexpected value: false
if true and ( not false )
Above is in cargo-make. Using duckscript main I have the following result:
if true and ( not false )
echo "1"
else
echo "2"
end
1
2
from duckscript.
It seems eval_condition_for_slice
only support literals.. (so not
cannot be used)
from duckscript.
sorry for the confusion, but conditions like in 'if' command are build either from
- variable
- command
- condition
in your case, i figure you think you have a condition, but a condition is defined by "A condition statement is made up of values, or/and keywords and '('/')' groups."
see docs at:
https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md#std__flowcontrol__If
the 'not' is not a condition keyword, its also a command:
https://github.com/sagiegurari/duckscript/blob/master/docs/sdk.md#std__Not
which i guess where the confusion is coming from.
so when you have a condition phrase, you can't use embedded commands inside since i have no idea where that command args stop and the condition phrase continues.
so you need to do
a = get_env ...
b = get_env ...
not_a = not ${a}
if ${not_a} and ${b}
...
else
...
end
from duckscript.
Yes, thanks for your answer and I’ve already fixed my problem in this way.
I don’t have strong opinion, and haven’t learned much about the design decisions of duckscript. Do you think make “not” a condition keyword can be more user-friendly?
from duckscript.
Related Issues (20)
- Zip/unzip command HOT 6
- --recursive flag for some `fs` commands HOT 8
- Using multiple backslashes results in only a single one HOT 4
- Embed Examples HOT 2
- Run commands in exec/Get stdout from eval/Add some form of command substitution HOT 5
- Passing stdin with exec HOT 4
- Upgrade regex package versions to >=1.5.5 (security vulnerabilities) HOT 1
- Newline Escapes HOT 3
- AUR package for duckscript HOT 3
- glob follows symlinks recursively HOT 3
- mv file.rs new_file.rs does not work HOT 5
- public new release after security fix from ftp crate
- Support array spread in exec HOT 7
- How to change a directory's name HOT 4
- `replace` can not accept a unicode character like \u{FEFF} HOT 1
- `if eq` does not support empty strings HOT 2
- WebAssembly HOT 5
- Builtin function for downloading latest||specific release for your OS from GitHub HOT 1
- Unable to access inner inner array from `json_parse` in a loop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duckscript.