Comments (5)
Keeping "external/unaffected" code part breakage low is what allows for gradual migration of code parts.
from oil.
The examples where tested in ysh, but of course it applies even more to using ysh-vars outside of procs in osh.
from oil.
So we now have value.BashArray
and value.List
which are different types
$ declare a=(1 2 3)
ysh ysh-0.19.0$ = a
<BashArray 0x7f3942b07190>
ysh ysh-0.19.0$ var li = :| 1 2 3 |
ysh ysh-0.19.0$ = li
(List 0x7f3942aee910) ["1","2","3"]
However you can splice BashArray into a List:
ysh ysh-0.19.0$ var li2 = :| @li @a |
ysh ysh-0.19.0$ = li2
(List 0x7f3942b075a0) ["1","2","3","1","2","3"]
It might be reasonable to go the other away, but it's not entirely trivial
e.g. "${a[@}"on a
value.List` could work but there's probably a bunch of stuff involved
I think we are going more from OSH data types -> YSH syntax, and not from YSH data types -> OSH syntax
from oil.
Sorry, I couldn't tell how hard or trivial it is.
But sure it would be useful to be able to use ysh vars from the ordinary shell language in osh. Actutally kind of expected you had included that in your thoughts, and that it would work, after reading your blogs about how unix/shell composes, and that ysh and procs are a continuation of that.
Procs can be called with the shell command language, they take shell variables but are not limited to them. So it seemed obvious to me that there would be a way to access the result of the enhanced procs (when using ysh vars) also through some compat shell mechanism for the composability. Very useful to make use of ysh code from osh/shell scripts.
from oil.
we now have value.BashArray and value.List which are different types
Ok, but is that a problem?
You gave a good example, showing procs can process bash variables with their ysh syntax (i.e. when sourced from osh). To afterwards access the results [EDIT: in newly created variables created by] ysh procs from osh, i.e. for interaction, osh code will also need at least the most basic access to ysh datatype variables (using shell compat syntax).
I don't see a reason for requiring to use the same data type internally.
(Well, now that I think about it, for ysh lists and dicts maybe? Could the new hashtable implementation for dicts also bring better search performance to lists? "if ... in list"? )
from oil.
Related Issues (20)
- Setting up GNU readline history HOT 1
- 'view latest' released version in documentation - because old links are often surfaced HOT 1
- crash in parsing return HOT 1
- BashArray could have a sparse representation (ble.sh)
- bash SHELLOPTS and BASHOPTS support
- pitfall - IFS= read x doesn't set x (read --raw-line or for <> loop instead) HOT 6
- Fatal error when closing stderr on a non-fatal error
- nixos defaultUserShell HOT 4
- `json read` unexpectedly parses `123\x00` HOT 8
- Sudo in dev builds isn't very necessary HOT 2
- duplicate error messages in redirects HOT 1
- segfault on MacOS - maybe related to case statement HOT 2
- define/document control flow out of eval, eval(), blocks, subprocesses (pipelines, subshells)
- osh hangs after nano and sometimes other outputs HOT 3
- tool to print sourced files - dynamic tree shaking
- Hay: Code nodes containing blocks don't serialize code correctly HOT 4
- trap INT doesn't run on Ctrl-C
- Trap does not check for the first argument being an unsigned integer
- can't Ctrl-C out of long operation (regex)
- osh pwd and ls disagree on current dir
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 oil.