-
Notifications
You must be signed in to change notification settings - Fork 247
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] 3.0: Scope, features and priorities #45
Comments
I think for this to work the framework will need to be installed global and have some kind of basher style package manager. In the include function it could look for a file called "main.sh" that would export the module to use in the installed packaged. |
Having a little look around I think it would be a good idea to make it compatible with bpkg. https://github.com/bpkg/bpkg |
Thanks for joining the discussion @AdeAttwood.
I'm also not entirely convinced about some of their decisions, like the one to use JSON to describe the package. It makes it easier for those coming from the NPM world, but on the other hand adds complexity (JSON parser) that could have been avoided. It would be great for a potential package manager to support monorepo-style packages (many packages per repo). This makes it easier to create micro-libraries from individual helper utilities, and is generally what helped JavaScript become what it is now. Some features would definitely have to be globally available (e.g. parametrized functions, module system), but that's a given in most languages anyway, but we could still keep many features in silos, if possible. |
Basher was the other one I have looked into. Not sure its what you looking for though. Maby create a merge of the two. Form bpkg I like https://github.com/bpkg/bpkg#package-exports for exporting or running. And also the config file defining the bin files rather than an install script. |
These are some really nice points. I will devote some time this weekend to lay my thoughts and feedback. |
Hii, i'm following this project for quite a time and it's a really project :D There is just one thing, i would even try to implement a web framework or classes into it. https://github.com/yoctu/yosh I have some other projects wroten in my framework but they're still close, they will be probably open this mounth. |
Before diving into the actual discussion, I believe it is important to acknowledge what bash is. This means that what we do should also be "bash-y", there is no reason to force OO if it feels unnatural/problematic or other project practices, eg configuration storing in json or yaml files. Also, I think that it would be beneficial to move in a 'set requirements first, implement after' fashion. Plus, whatever we decide to implement should be of coming from an actual need and practical use case, to avoid creating a framework that is of no use. Bash Infinity has already done a great job in that aspect, so let's keep the standard up! What is a Bash FrameworkThere seem to be 3 types of bash frameworks. One common type is a collection of functions, aliases, etc to make life in the terminal (and perhaps writing scripts) easier. The second type is frameworks that provide a mechanism into which to hook to get your application running, like the go-script-bash framework. Finally, there are frameworks that intervene in the way you write bash code. This is were we are. I mention this to make clear what should go into Bash Infinity and what not. For instance, it does not make sense to have eg a git module. To answer to @dzove855 , your project seems to me like sth that would be better written in Bash Infinity, than be part of its core. This means that parts of your project could be replaced by (or contributed to) Bash Infinity's core. Module SystemI think that there are three, though tightly related, things here. One is essentially a package/module manager, the second is a spec on how to interact with the packages/modules and third is our implementation of that spec. I think that we shouldn't try to do all three in the context of this single project, especially if we aim to bring interoperability into the bash ecosystem of projects. I propose the following action plan:
Some questions that would need to be addressed by the spec would be:
Also relating to the package manager implementation:
The module system you have posted looks great and we could start with this while developing version 3. But for instance this line: local path="${1}" needs the above discussion to be settled first, IMO. Features from 2.0I agree on your shortlisted features to aim for initially. For me, what bash programming is all about is basically commands and functions. We should focus on interacting with them as easy and intuitive as possible. In the mean time, we could start developing the framework library of helper functions (eg for string manipulation) as the needs we encounter come. FunctionsLet's start with functions, that practically means passing arguments and getting output. For argument passing, the main pain points for me are:
The current notation of Bash Infinity is excellent, but maybe limits the implementation possibilities. Let's work on your code in #41 and research the possibility of backwards compatibility. For getting output from a function there are 3 possibilities (that I know of) in bash:
I would like to have sth that makes this as simple as possible, without messing the scope of variables. I have some ideas to test out. Error reportingBash Infinity currently prints a fancy call stack. This is helpful. But I often find myself wanting to:
Moreover, when trying to debug a script, Bash Inifinity internals get a lot in the way. For instance, running with Working on this and porting parts of the existing stack trace will also be a good opportunity to work on the UI stuff. Sth related is error logging. Contrary to error reporting which is useful for interactive sessions, logging is a second channel of error output. Bash Infinity has some kind of logging, but it feels a little incomplete, am I wrong? These will keep us busy for a while. Then, we can look into variable typing, code structures, etc. I suggest we keep this discussion here. After we conclude on the requirements, we can break them into issues, set some milestones and keep track of the progress there. The next 2-3 weeks will be really busy at work, so my presence here will be sub-optimal, but I will try my best to keep things moving. |
Hi guys, I want just to come with an idea. For example: |
From @adudek #69 (comment)
|
BTW as for unit tests, I also like https://github.com/kward/shunit2/ very much. It is basically a more "traditional" version where not each line is an assertion. |
I got drawn by other stuff, but here is a small draft I created on named parameters. I "stole" this wonderful macro snippet. What do you think? |
That would be very valuable, since many non-trivial scripts require a form or another of CLI args handling. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Continuing from #44 (comment).
@tterranigma Let's discuss the scope of 3.0.
I've added you as a collaborator so you have push rights to the repo.
We should decide on the features to focus on implementing and problems needing tackling first. I've opened a clean branch (3.0) so we can work with a clean slate.
We can keep the outcome of the discussion as documentation inside of the repo itself, e.g. in a
docs
folder.Some things that come to mind while designing the future:
Module system
Any respecting language ecosystem has a module system for managing and sharing dependencies/libraries (JS has
npm
, Python hasPyPi
, Ruby hasRubyGem
, C# has NuGet, and so on). I think we should think about both a method of sharing internal and external "modules", which is especially difficult, since functions are global inbash
.For a non-polluting way of loading, I propose something in the lines of my experiment here.
For a shared repository of public (and private) libraries we could use GitHub, just as
Go
does it.Another useful feature that I thought about is would be "bundling", i.e. replacing and inlining all imports, in order, with actual code. This would be great for distributing, since you could use all the features you want and just move/upload a single script file that has all of the functionality embedded.
Features from 2.0
Which are the most important to port first?
Other ideas
bashdb
for debugging would be really useful.Thoughts?
The text was updated successfully, but these errors were encountered: