Re: [Seed7-users] Q&A
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Thomas M. <tho...@gm...> - 2012-08-12 20:25:49
|
On 2012-08-02 06:10 Kobi Lurie wrote: > On 08/01/2012 04:51 PM, Thomas Mertes wrote: >> In the meantime the existing documentation of the primitive actions at >> >> http://seed7.sourceforge.net/manual/actions.htm >> >> can be used to see how a foreign function call can be done. > ok, I'll look it up. > I think I'll start by learning the language with simple exercises, > algorithms or data structures. When you have questions, just ask. >> then, later, probably contribute as I go along. (but let's not promise > anything ;-) Okay. >> 2) gui - is there a gui library? >> Seed7 has a graphics library, but currently there is no gui library. >> Except for the Gtk-server connection library provided by Leonardo >> Cecchi. I have a plan to have an interface description and to use >> this description for a web based interface and for stand alone >> programs. But until I get massive support this will take very long, >> to be realized. > The graphics library looks really cool, from first impressions, it looks > suitable for lightweight games and small customized applications. > However for commercial development, I assume most users like to see a > familiar UI, while the developer would like to not be held back by > unimplemented widgets, which is where the mature gui libraries come in. Agree. My attemts to write a gui library are described below. When you need a gui library now I suggest you interface to an existing one. >>> It seems portability in the language >>> was a main concern, what do you feel about libraries such as fltk, or >>> preferrably wxwidgets? (or is there a home-brewn one? do you wish for >>> everything to be in one ecosystem?) >> Interfacing with a library is okay. I don't know fltk and I have >> only little knowledge about wxwidgets. Fitting a gui library fully >> into the Seed7 ecosystem is probably not easy. Is it possible to base >> a gui library on the Seed7 graphics library? I would like to avoid >> event loops in the user program (I hate event loops). I also don't >> like redraw events. It is just stupid when the program gets told: >> I just deleted your window and you should redraw it. >> What would programmers say, when this happens with files? >> But this are just my wishes. When you do the work you are allowed >> to ignore them. Feel free to add a cgi library to Seed7. I promise >> to add it to the release, when it is not buggy and somehow useable. > I don't know much about the web so probably cgi support will not come > from here. Sorry I made a typo. I wrote cgi instead of gui. I wanted to say: Feel free to add a gui library to Seed7. > I feel similarly about events. Since they can "jump" up on you, you > don't know where they came from, they're not in the code flow, so it's > harder to reason and figure things out, especially for a larger program. > > However what is the alternative? since in a gui application all the > widgets are ready to accept input. they are like entities themselves. > How would you do that with one codeflow? Maybe a system with input forms can be used. I am experimenting with a gui library based on cgi forms. The form describtions look like data structure descriptions. I would like a system where a user interface definition is useable for stand alone applications and for web (CGI) interfaces. But the realization will take a long time. Don't wait for it. > FWIW, If you're indeed going to implement a whole gui system, based on > the Graphics lib, I suggest looking at Rebol's gui dialect, which is the > nicest way I've seen for building GUIs. Moreover, maybe you can leverage > other's work for example cairo, agg, or clutter. > > Another promising option is QT's qml, which is an interpreted markup > language for ui. (similar to json in structure, css in definition, and > has some interaction, and conditional rules). > I don't know, however, if you can really make large applications with > qml, and still be able to keep things under control. > oh, there is also the way fantom do gui's which may be similar to what > you want to do on the web. > they compile the application both to java for the desktop (or c#, > configurable) and to javascript for the web. Thank you, for your suggestions. >> To add 1 to each array element the expression >> >> doMap(testArray, x, x+1) >> >> can be used. The map function looks a little bit like a for-loop. >> The variable x must be provided as parameter to doMap. > hmm.. how does anExpression (inside the for loop) know to take aVariable > as its parameter? > oh I see, they are just expanded to the external code x and the other x+1. > that's quite smart. > > Is it possible to make map generic? instead of an integer - it would > take a T, and return a T array? Yes, it is possible. See: http://seed7.sourceforge.net/examples/generic.htm I also added an example with a normal map function. See: http://seed7.sourceforge.net/examples/map.htm >>> 4) auxiliary and fancy stuff - >>> unit testing (and mocks), >> Currently no special support, but I don't see problems. >> The functionality of the Seed7 interpreter and compiler is checked >> with several programs. > I am sure the quality of your code is very high. It's my own feeble mind > I'm worried for :-) > It helps me to check myself, since if the program gets complicated with > time, it's harder to find the source of a bug. I know that you are talking about unit testing. I just want to mention that compiled Seed7 programs can be debugged with a source code debugger. Instructions in the generated C program refer to the original source. This way a source code debugger like gdb can be used. > In recent years there is also 'tdd' (test driven design) where unit > testing has become a continuous and part of the coding process. > mocks is about "faking" objects, usually by reflection, creating empty > functions and defaulted fields and storing the invocations, so for > example, you can test that your client code works, without connecting to > the server. > since you know what the server is supposed to return to you, you "fake" > the server object, returning canned responses that you prepared, and > later it's possible to verify what was called, how many times, etc. > Sometimes it helps, since you can get the program up and running fast, > and then fill all the holes with actual functionality. having a working > program is usually easier than waiting until all the code is finished > just to test it. Things can get complicated sometimes when a bug was > introduced but alot of code was written in one chunk, so which part is > good and which isn't? > I think mocking mainly arose from object oriented and events, which can > get messy. > An example library is moq. http://code.google.com/p/moq/ Thank you, for the hints. >>> design by contract, >> Currently no special support >>> ADA's argument ranges, >> Not sure what you mean with this. Seed7 supports positional >> parameters and does not support named parameters. > I saw that new version of Ada define ranges for the input parameters > as seen here for example: > http://en.wikipedia.org/wiki/Ada_(programming_language)#Data_types > I think this is a good feature. > probably just asserts in runtime, and is basically an invariant (like in > eiffel). > that's good in order to know that your data didn't get corrupted somehow, > and also (as you get the assert) you can know where that wrong data came > from. > this is basically the advantage for dbc (design by contract) too. > it's just a 'requires', that checks the input arguments. 'ensures' that > checks the result, > and an invariant which isn't in a function but in the class, so it > checks the object's state wasn't compromised. I see. >>> mixins, >> The functionality could probably be provided with Seed7 templates or >> abstract data types. >>> multiple inheritance, >> Not supported >>> events, >> I already explained, that I don't think that event loops are a good >> idea. But nobody hinders you to process events with Seed7. >>> fine grained accessibility (not just public private but having syntax >>> to limit to a function or class or with wildcards), >> Fine grained accessability is currently not supported. > Yes, this is somewhat experimental. didn't really expect it. more of a > feature request :-) >>> actors and network programming ... >> Not sure what you mean with this. Seed7 has support for networking >> (FTP, HTTP) and CGI. > I meant to ask about concurrency, threaded or actors-based, for example > in erlang there are lightweight processes, others use co-routines. > about networking, I am assuming sockets. Currently there is no threading / lightweight process support. There is socket support. The other networking support is based on socket support. Regards, Thomas Mertes |