Coder Social home page Coder Social logo

Comments (6)

sagiegurari avatar sagiegurari commented on August 27, 2024 1

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.

xxchan avatar xxchan commented on August 27, 2024

Besides,

not false and false

gives true is a little confusing... Although I can kind of understand it.

from duckscript.

xxchan avatar xxchan commented on August 27, 2024

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.

xxchan avatar xxchan commented on August 27, 2024

It seems eval_condition_for_slice only support literals.. (so not cannot be used)

from duckscript.

sagiegurari avatar sagiegurari commented on August 27, 2024

sorry for the confusion, but conditions like in 'if' command are build either from

  1. variable
  2. command
  3. 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.

xxchan avatar xxchan commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.