![]() Of course it is already possible to create non-trivial data structures with TCL, but the lacks of references makes this structures not good for almost all the tasks where complex data structures are really useful. Salvatore Sanfilippo: I like TCL for many reasons, but I must admit that the fact I can't use references to create complex data structures like a graph is for me the biggest TCL problem. Still, if feather might solve that, why not try and revive that? I think I heard from Paul Duffin that it never came past a bunch of ideas. Puts "We are out on an extended lunchbreak"īut that is just a feeble attempt to a joke. I think that feather will resolve some of these problems.Īrjen Markus: Yes, I realise that it would be a lot of work, I had thought of a quick implementation like: You shouldn't have to build a whole new system. But all references are stored as data, so when a reference variable gets set or unset, you may register this event and do a bit of cleaning up.ĭavidw: No, because I know I'm right -) Basically what you are doing, in a clever way, is building your own memory system on top of everything else, which is neat, but the point of a higher-level language is that memory management gets done for you. SS: see TCL references in TCL for a pure TCL implementation of references and garbage collection.Īrjen Markus: You are not satisfied quickly, are you? :-) Well, the whole model must be elaborated a bit, as now it will work only for examples structured in the same way as the original - pairs of pairs of elements and the like. It can undoubtedly be done more elegantly, but that is not the point: I have proven (I hope) the concept of referenced data in pure Tcl.ĭavidw: Now add garbage collection to it. References are regarded as ordinary data and stored in the global list that holds all information. Note that the whole trick is that the data in the list are either tagged and hence identifiable as a reference (or better a pair of references) or not, in which case they are ordinary data. Set ::referenced_data Īppend print_data "( " " " \ Linked lists aren't really all that necessary in Tcl for the simple case, but references allow you to easily construct more complex data structures.Īrjen Markus: Can this not be achieved in a very similar way as in Scheme (the LISP dialect I am gradually learning because of the SICP book)? For instance: find it difficult to envision how to efficiently implement such solutions in Tcl with only flat lists and hash tables.ĭavidw: the real problem is not linked lists in and of themselves, but the lack of references. LV: I'd say the issue is likely this - people used to algorithmic solutions requiring specific data structures, such as structures, linked lists, etc. Mike Tuxford notes that no one mentioned that RMS is also the author of emacs, besides being in the news a lot defending the OSS model.ĬL mentions that, true as this is, the 'O' in OSS is anathema to RMS, last time I checked. OTOH, recursing over lists involves copying in Tcl, so real linked lists like LISP's CAR/CDR also have their advantages. iterating over it, is easily reached with foreach. (See Who says Tcl sucks.) I also have problems understanding the need for linked lists - Tcl's are contiguous in memory, so the benefit of links, i.e. RS: RMS is Richard M Stallman, a famous programmer in the GNU scene, but not enthusiastic about Tcl. I regard his/her statement as an example that most people can not distinguish implementation and concept!ĪMG: Don't mean to interrupt, but this reminds me of. But yes, RMS is such a 1980's LISPer that he probably wouldn't acknowledge anything not built on references as "lists".''Īrjen Markus: I do not know who RMS is, but "woe, ye of little imagination," Tcl lists can be used as linked lists - if you regard a linked list as some abstract data structure (apart from the implementation!). Lars H: Well, he also considered a version of Tcl way older than Tcl 8.0, which is where we got Tcl_Objs and sharing of values algorithmic complexities were a bit different back then, and that could also be a reason to reject Tcl's list. RMS's point, I think, is that Tcl lacks references. Fut: Thanks to copy-on-write, linked lists can be implemented trivially in Tcl.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |