From: Fu Limin Date: 2005-04-29T19:54:28+09:00 Subject: Re: Re ANN: A new scripting language Tao 0.9.0 beta released! Donal K. Fellows wrote: > Fu Limin wrote: > >>In what ways is your language distinctive? > > > > Well, I think the most distinctive feature is the integration of powerful > > text processing ability and powerful numerical computation with a > > simple syntax for them. I also try to support a simple and transparent > > interface to C++. Though there is still a long way to go, I think the > > status of Tao is promising, in fact I already benefit from it in my > > research where both text processing and numerically computation are > > important, for which I "suffered" a lot from using Perl in the beginning, > > which drived me to design my own one ^_^ > > Ah, the dilemma between whether to create your own or extend what is > already there. Myself, I prefer the second option because that lets more > people use it with a lower overhead; the barrier to entry on an entire > programming language is quite a bit higher even if the integration it > affords you is more closely tuned. You can see the reason why I chose the first in my reply to Josef 'Jupp' SCHUGT in comp.lang.ruby group. > > >> How does developing your own > >> language (as opposed to making stronger one of the languages whose > >> newsgroups you've posted to) make the sum of human experience richer? > > > > For the existing languages, I think they have already stabilized a kind of > > philosophy, and something have already got complicated. So I think it > > would be more difficult for me to dive into them. Anyway, I believe it > > worth trying to design a new language, if I found it more usesful in some > > work than the other languages, somebody will also find this. A new option > > is not bad thing. > > Every programming language is really a different way of thinking about > programming problems. The hard bit is determining whether you're either > covering some new fraction of the noosphere, or if not, covering some > useful distinct subset of it instead. It is also a curiosity that > sometimes reducing the number of things you do can make a language more > suitable for some kinds of tasks (security often seems to work out that > way for some reason). Yes, that's why I mostly concentrated on both regular expression and numeric types and operation. > > [Below, where I've not replied to some point made, it's because I don't > feel I have anything more to say on the matter at the moment.] > > >>Odd things I've noticed in a quick trawl through your docs: > >> * What no bit-ops? And why give ^ a non C/C++ meaning? > > > > My using of ^ as power is influenced by Matlab. In the beginning I didn't > > know it is also used in C/C++. > > An alternative would be to use ** for exponentiation, deriving from > Fortran, and give the bit-ops their conventional C/C++ meanings. Yes, this can be done. I didn't use Fortran for long time, I really forgot there is such an alternative as ** :) > > >> * What sort of characters are you using? > > > > For strings, I use stl::string, so I didn't care about this. > > But for byte type numeric array, I used unsigned char. > > The real Q here is chars vs. characters. :^) Sorry, I don't understand what you mean by chars vs. characters. Do you mean the encoding? > > >> * How does passing by reference square with constant arguments? > > > > In Tao constants are also represented by objects, their passing by reference > > are the same as other types of objects. > > So, that would mean that it is possible for a constant to be altered? My > goodness me, that reminds me of some awfully buggy code I've seen in the > past! Please make sure that you can't ever change the actual constants > that come from your program (setting 0 to 1 is a good way to make things > go belly up!) If you mean constant variable, yes, otherwise no(for constant value,strings). When a constant value is passed as parameter to functions, a new object is created to contain the value. But they are really created only when necessary, the interpreter takes a strategy to avoid unnecessary allocation of new objects. (Maybe this is the real answer you wanted:)) For example: routine routA(a){ print(a); } routine routB(a){ b={}; b.insert(a); } for(i:=0;i<10;i++){ routA(222); } for(i:=0;i<10;i++){ routB(222); } In the first loop, only one object is created in the beginning, the same object is used in the following cycles, because that object is not assigned to any variable or inserted to any array, so the its reference count will not change, this means it is still "free" for following use. While in the second loop, new objects are created, because insertion of them to an array will increase the refCount of newly created objects. But constant variable can be changed only if there is the keyword "const" precede that variable, which means to re-initialize it. So the the program will not alter a constant variable by mistake. If it is necessary, this can also be changed. > > >> * Your I/O interface has a /long/ way to go! > > > > Right. I haven't concentrated on this part. The status of IO support > > deosn't conform to the version number which increased too rapidly :-) > > Concentrate on producing a system for externally-defined loadable > modules and put (most of) your IO code in one of those. :^) Some people > have had real success with doing that. Good suggestion, it's my second time hear this kind of suggestion, I will do it in this way, so the basic IO will be built-in while advanced IO will be provided as modules. > > >> * Given that you are using mutable objects, do you have a way for > >> someone to force a duplicate of an arbitrary object? That would make > >> doing things like security separation much easier. > > > > If you mean data object, yes, but it's not available for users yet. Now it is > > mainly used for passing Tao data types to C++ modules, where each Tao > > object can be copied and converted into its C++ equivalent object > > (though internally they are all C++ objects, but the object used in C++ > > modules is different from the one used in Tao interpreter, e.g. TaoHash is > > used in the interpreter, while TcHash is used in C++ module, the conversion > > or copying keep its structure including cyclic ones). > > Firstly, control of when things get duplicated is very important, > because doing a deep copy of a large object graph can be expensive. The > easiest way to handle this would be to put in a monadic operator that > duplicates an object. Yes, in Tao objects are copied only when they passed to a function from external modules, even in this case, the real data of numerical arrays are _NOT_ copied, only the pointers are passed. > > Secondly, is it really necessary to have TaoHash and TcHash as separate > things? Unifying your entity system might be a big win over the longer term. It really depends. TcHash is only used for external C++ modules as a bridge to pass data from and to C++ modules. The reason why I don't want pass TaoHash directly is that, to pass TaoHash, it means Tao must provide additional library to C++ modules for linking, and in Windows there could be some problems for this since STL and static variables are used. To provide TcXyz, only minimum interfaces are provided and can be put in a single header file. In this way it's possible to develop C++ modules for Tao with only two header files, nothing else!