-
Notifications
You must be signed in to change notification settings - Fork 2
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
Remove dependency on Ruby #1
Comments
I'll answer your comments below:
I will write more detail about the tools. |
What does that mean? As a Windows user, can I grab the orb tool and get going without installing Ruby? |
Yes, when there is a pre-compiled binary available, which there currently isn't. But to compile Orbit you need to link to libruby. |
Using Ruby for this still seems very odd to me. When I want to do D programming I want to use D, not Ruby. Even if it's slightly suboptimal, I'd rather be able to look at package specs and see the language that I should already be familiar with. If I want to write an orbfile or somesuch, and I have to do nontrivial things, the LAST thing I want to do is spend a day or two learning Ruby before I can get serious work done. Do you have any examples demonstrating why D is severely disadvantaged at doing this? That is, code that looks ugly and can't be fixed due to D's limitations? |
Since there seem to be a lot of people who rather want to use D than Ruby I can see if I can do anything about it. But in general I think D is too verbose for this type of things. The nice thing about Ruby is that the syntax allows to write in both in a style that looks like a declaration language and in a regular style. For example, this is how the orbspec looks like for my serialization library:
In D it would look something like this:
If we then take a look at an example of some more advanced features it would look something like this:
D:
|
Cool! Honestly, the D code doesn't look that bad to me. Of course, I will happily use any procedural language as a declarative language when duty calls. It's just a bad idea to do that when non-programmer users or people without working build systems have to configure the declarations. D can be invoked as an interpreter though, and people using this will have D compilers, so it's no problem. For the first example, I can deal with that. In fact, "glob" is easier to look up than... Dir[A/B]? Maybe replace version_ with ver. I would suggest the following change to the second example:
I assume the program using the orbfile pastes it into some context. This context could then have a statement like:
(Untested, of course.) |
This is also a problem, I'm not completely sure how to do a runtime "eval" with D as the language. |
Why is eval needed? I'll admit it can be handy, but there are many compiled languages that get by alright without it. D can at least do the same thing at compile-time. So, where does it come up and why is it needed? (I do hope for a day when we have dynamic linking down-pat. Then an "eval" function can be implemented by compiling the string it's passed and then linking against the result.) |
@jacob-carlborg I was playing around with this the other day. I think I may have found a solution. It's a little messy, but it achieves what you want. First, you write a handler script, import std.stdio;
static if (!__traits(compiles, {import orbspec;}))
{
static assert(0, "Couldn't find \"orbspec.d\" or it wasn't valid D.");
}
else
{
import orbspec;
}
void main()
{
static if (!__traits(compiles, NAME))
{
writeln("You didn't define \"NAME\"");
}
else
{
writeln(NAME);
}
} Then, in the root of some project, you must define auto NAME = "My Project"; Then, from the command line, a user would change directory to the project's directory (that has Of course, that You can add in "optional" features that It's a little more verbose than Ruby, but it makes sense that Orbit should eat its own dog food. I think it's pretty nifty. |
I haven't examined Orbit in detail, but one design decision that sticks out as strange is the dependency on Ruby.
Ruby and its associated tools are a big dependency to pull in for a trivial use. Ruby isn't installed by default on any distros I know of. That reason alone is enough for someone to not choose Orbit.
In any case, there's no justification. The reasons given in the wiki are
The text was updated successfully, but these errors were encountered: