FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The [F]AQ Thread

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Fri Dec 05, 2008 9:11 pm    Post subject: The [F]AQ Thread Reply with quote

I'm starting this thread as a place to field questions about the language and library. It would be an FAQ except that I don't think the frequency of a question being asked has any bearing on its validity Wink

Please, ask anything - anything at all. Anything that comes to mind, no matter how small. Confused about something? Want to make sure you've understood something correctly? Don't hesitate, just post it. I'll probably be distilling the results of this thread (which I'll just have up here for a long time) into a wiki page as well.

The one thing that you shouldn't post here is suggestions, wishes, and the like. This is just for questions about the language and library as they are.

....and go.

...

I SAID POST STUFF Wink
Back to top
View user's profile Send private message
Kosmonaut



Joined: 22 Jun 2008
Posts: 10

PostPosted: Wed Dec 10, 2008 4:17 pm    Post subject: Reply with quote

Well, not exactly a question to be included in the F.A.Q., but it would be great if the Library Tutorial could be finished. Part 4 thru 7 are yet to be written. Smile
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Wed Dec 10, 2008 5:39 pm    Post subject: Reply with quote

Oh of course, that's one thing I want to do before I release 2.0. It's just that I have no time this week.
Back to top
View user's profile Send private message
Ligustah



Joined: 21 Oct 2007
Posts: 45
Location: Berlin, Germany

PostPosted: Fri Dec 12, 2008 2:47 pm    Post subject: Reply with quote

I don't know if that really fits here, but i still would like to know, if MiniD2 will include support for dynamic libraries, or if the problem is still the same.

-- Ligustah
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Fri Dec 12, 2008 7:25 pm    Post subject: Reply with quote

The problem is still the same, unfortunately: there is no cross-platform way to do it. Thankfully there is more activity on DDL than there was for a long time, and I've heard rumors that ELF support will be coming soon. As soon as that happens, I'll get to work implementing it, but that'll probably be after MD2 comes out.
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sat Dec 13, 2008 12:37 pm    Post subject: Reply with quote

What's MiniD good for? Why should I use it? Smile
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Dec 14, 2008 12:09 am    Post subject: Reply with quote

Quote:
What's MiniD good for? Why should I use it?


OK, good question Very Happy

MiniD is designed to be used primarily as an embedded language, that is, embedded within a larger host application. The API is designed around this, so it's much easier to write D code that interacts with MiniD than, say, Python or Perl. Why would you embed MiniD in your D programs?

  • You have a large-ish application, such as a game or 3D modeler or music composition program, in which you want to provide end-user modification without having to distribute your source code or force users to learn a complicated new system-level language. So you let users write plugins and addons in MiniD and have your D app load them.
    • World of Warcraft uses Lua to script its user interface and hundreds of addons have been developed for it because of that.
    • There's a program called.. "Anime Studio" I think it's called now, a 2D animation program, which lets you integrate tools written in Lua as seamlessly as the built-in tools.

  • You again have a large-ish application, but writing high-level code in D might get tedious. Especially in realtime applications like games where memory and resource management can get in the way. Recompiling a huge program can also be a pain. So, you write the performance-intensive stuff in D, and write the less performance-intensive stuff in MiniD, which can be much more expressive and more easily modifiable.


There has also been considerable interest in using MiniD for - of all things - server-side web scripting. I mean, I guess it's a pretty good fit. It's a lot smaller and faster than most languages that are used for it (PHP, Python, and Ruby are not at all noted for their speed, and they're also enormous). I'm not much of a web programmer but any improvement on PHP is certainly welcome Wink

On the other hand, MiniD is just.. fun. It can express high-level concepts in a tiny amount of space, and its set of types and overloadable operations make it easy to express most things that you can in a much larger language like D. With some bindings to some multimedia and GUI libraries, it would probably be a fine language for writing little standalone programs. I already use it regularly for "shell" scripting (and have been considering the possibility of a proper MiniD shell, ack).
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sun Dec 14, 2008 10:13 am    Post subject: Reply with quote

Cool. Very Happy
So, if I wanted to start using MiniD in my D programs, how would I go about installing it? Are there tutorials, is it included in the documentation?
I did see the tutorials about MiniD on the project page.
Also, would I use the MiniD2 RC, or MiniD1?
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Dec 14, 2008 11:12 am    Post subject: Reply with quote

The front page describes a little bit on how to install it, but I plan on greatly improving and extending all the documentation in the next few weeks.

If you have DSSS, you can just use "dsss net install minid" and then use DSSS/rebuild to compile any programs that use MiniD.

More generally, all you need to do to install it is to check out the SVN trunk to <some directory> and then add <some directory> to your import path. Use of a build tool like DSSS/rebuild or Build/Bud makes things much easier than manually compiling/linking, so if you're not using one already, use one Wink It's not necessary to compile MiniD to a static library before using it; having it on your import path is enough to have your build tool compile it into your app.

To get the SVN trunk, if you have subversion installed (it's available for any platform), use "svn co http://svn.dsource.org/projects/minid/trunk <some directory>", where <some directory> is the name of the dir you want to put it in. This directory will contain some stuff including the actual "minid" directory which contains all the modules that you import.

If you don't have subversion, you can grab a zip of the trunk by going to the source browser and choosing the "Download in other formats: Zip Archive" at the bottom-middle of the page. Then you unzip that file to <some directory> just like with SVN.

And lastly - please use MD2, as MD1 is olde and crappy. Wink I am no longer supporting my old implementation of MiniD 1. MiniD 2 is much more fully-featured and I'm still working on it, so I'll fix any bugs in it that you find.
Back to top
View user's profile Send private message
sleets



Joined: 29 Jun 2007
Posts: 27

PostPosted: Sun Feb 15, 2009 2:06 am    Post subject: Reply with quote

when i build the minid2.lib with tango r4317 & dmd 1.040 by command "dmd @allMinidFiles.txt -g -unittest -debug -of=minid2d.lib"; is fine.

but if i use the "-inline -release -O" it take a very long time and not finishied, I remove the "-inline" it work fine.

why it can't work with "-inline" ?
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Feb 15, 2009 9:23 am    Post subject: Reply with quote

To be honest I'm not sure. DMD's inliner seems to be very slow. It will complete after a while. I noticed that the inlining got much slower with the new library (the MiniD 1 library compiles much faster with -inline than the MiniD 2 library).

In any case, I don't notice a very big performance difference with inline than without it. -O seems to help it more. You can probably leave it out without much trouble. (-inline sometimes breaks things, too.)
Back to top
View user's profile Send private message
Kosmonaut



Joined: 22 Jun 2008
Posts: 10

PostPosted: Sun Jul 05, 2009 1:21 am    Post subject: Reply with quote

1. It is possible to load/save a compiled script?
[bearophile]Something like Python's .pyc files.[/bearophile]

2. It is possible to load a script from memory?
For example, embedding a script in the executable file, and later loading it as a resource.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Jul 05, 2009 9:05 pm    Post subject: Reply with quote

Kosmonaut wrote:
1. It is possible to load/save a compiled script?
[bearophile]Something like Python's .pyc files.[/bearophile]


Lol, and yes. minid.serialization allows you to serialize a function as a binary module file. For an example of use, see minidc in the trunk, a tiny program that just takes a source file and spits out the binary representation of it. When performing an import, the default import mechanism will look for both source modules and binary modules and load whichever is newer. You could modify the default mechanism to save the compiled module when importing from source.

Quote:
2. It is possible to load a script from memory?
For example, embedding a script in the executable file, and later loading it as a resource.


Sure. Have a look at minid.ex.loadString for compiling a set of arbitrary statements. There's a conspicuous lack of a native API function for compiling a whole module from memory easily, but there is the modules.compile function in the MiniD stdlib. You could call that from the native API too.
Back to top
View user's profile Send private message
Kosmonaut



Joined: 22 Jun 2008
Posts: 10

PostPosted: Mon Jul 06, 2009 11:07 am    Post subject: Reply with quote

Thanks, I'll take a look. Smile
Back to top
View user's profile Send private message
fraserofthenight



Joined: 08 Apr 2007
Posts: 33
Location: Seattle, WA

PostPosted: Fri Oct 30, 2009 1:20 am    Post subject: Reply with quote

I'd also like to mention that the fact that MiniD has a sane license (allows redistribution) and mdcl is a single binary makes it great fr writing cross-platform shell scripts. I'm using MiniD as my "makefile" since actual makefiles are quite limited and platform-dependent. So while it's easy to embed and high-performance, don't think it's not useful for simple scripting tasks, too.
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group