Re: [Vala] Vala on Windows/Mac OS

2011-12-17 Thread Jim Peters
r. This would also make it easier for refactoring tools. Worth experimenting with.) Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(

Re: [Vala] try/catch concepts

2011-11-14 Thread Jim Peters
code, little discipline, few checks), I think that is supported because uncaught exceptions generate compiler warnings instead of errors. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /

Re: [Vala] How to ignore exceptions?

2011-10-31 Thread Jim Peters
function could be written that doesn't generate an exception, if the exception is never useful. So there could be two calls: do_something() and do_something_ignore_error(). Jim -- Jim Peters (_)/=\~/_(_) j...@uaz

Re: [Vala] Array resize

2011-09-28 Thread Jim Peters
same for me: 1 1 2 2 3 3 4 4 ::: 98 98 99 99 100 100 Are you running an old version? Or a very new version with a regression? (If so, log a bug.) Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net

Re: [Vala] Vala logo symbol voting

2011-08-30 Thread Jim Peters
o maybe Aladdin's flying carpet? Or something else to represent the ease and feeling of flying above complexity? Any other way we can represent this feeling? Or is there some other feeling we can associate with Vala? Jim -- Jim Peters

Re: [Vala] I'm missing Java's anonymous classes

2011-08-05 Thread Jim Peters
can never be passed to a > > constructor. > > I think this can be fixed a using a separate alloc step > (like in objective-c?). Yes, good point -- that would work. Jim -- Jim Peters (_)/=\~/_(_)

Re: [Vala] I'm missing Java's anonymous classes

2011-08-05 Thread Jim Peters
part. But 'self' hasn't yet been initialised, because the widget constructor call hasn't yet been made, so NULL is passed. There is no way that the Vala compiler can make this work, as far as I can see. A delegate which depends on 'self' can ne

[Vala] I'm missing Java's anonymous classes

2011-08-05 Thread Jim Peters
a lot more readable when the callbacks are inline (either as delegates or as an anonymous class), but I really can't see a sensible and safe way of doing this in Vala. (In real life I have several methods that may need overriding, and several layers in the

Re: [Vala] Vala logo, take three?

2011-07-29 Thread Jim Peters
Luca Bruno wrote: > I retry with another logo :) > > http://i.imgur.com/oFwpC.png (attached is a remix to make it spell the whole word) Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_

Re: [Vala] Ref parameters to async methods

2011-07-23 Thread Jim Peters
ntaining the variable you 'ref' in the call will probably have completely gone by the time it is written to, so (if it were allowed) you'd risk crashing your app due to corrupting the stack by using 'ref' with async. Jim -- Jim Pe

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-16 Thread Jim Peters
ation page. I replaced the old "Asynchronous Methods" section in the tutorial after checking that everything it said was covered in the new text. The original GIO example has gone into the AsyncSamples page. The busy wait example seemed more confusing than helpful as the busy wait itself

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-16 Thread Jim Peters
all day optimising the Generator, you could also try implementing 'fast iterators' like in Apple Objective-C, where the generator code fills a buffer with N items, and then iterator runs through emptying it, and then they switch again. J

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Jim Peters
re is for documentation, or who owns what. This page could be merged with the Tutorial if someone thinks that is a good idea. If there is anything incorrect, I'm happy to fix it -- Jim -- Jim Peters (_)/=\~/_(_)

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Jim Peters
ed to implicitly register a > > _finish method for the async method". What does this mean? Also: > > "end() is a syntax for the *_finish method". I'm confused. > > Try looking at the generated C code. I think the second phrase m

[Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-14 Thread Jim Peters
for example, seems to run through fine without a main loop. - The docs say "The .callback call is used to implicitly register a _finish method for the async method". What does this mean? Also: "end() is a syntax for the *_finish method". I'm confused. If some

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-13 Thread Jim Peters
) { if (i<10) Posix.stdout.printf("%i\n", item); i++; } print("\n\nResults computed in the second generator\n\n"); i=0; foreach (var item in gen_1) { if (i<10) Posix.stdout.printf("%i\n", item); i++;

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-12 Thread Jim Peters
Jim Peters wrote: > > Threads are allocated on multiple cores nowadays and you can use > > lock-free data structures when possible. Still you didn't provide > > any benchmark, only thoughts. > > We are both putting forward "only thoughts". > > To p

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-12 Thread Jim Peters
plement simple coroutines in Vala using low-level C stuff, i.e. setcontext/makecontext/etc. I guess a Coroutine class could be useful for something someday. Give me a moment ... Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-12 Thread Jim Peters
th a coroutine style. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(_)http:// in Peru(_) /=\ ~/_ (_)

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-12 Thread Jim Peters
e the kernel to schedule a context switch. This HAS to be slower -- at least that's how it seems to me. Maybe this could be made more workable using 'Pth' instead of kernel threads, or by using the async stuff already in Vala. (Sorry, I&#

Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-12 Thread Jim Peters
ertainly you can emulate them but it's not going to be an efficient way of implementing algorithms unless someone puts in the work to make it efficient under the hood. If convenience matters more than efficiency, then no problem. Jim -- Jim Peters (_)/=\~/_(_)

Re: [Vala] Threads and closures problem

2011-07-10 Thread Jim Peters
ence through the now-destroyed closure and causes a segfault, which is why this code goes via 'tmp' within the closure. Hopefully I'm not breaking any rules. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_)

Re: [Vala] Why the temporary variables in the C code are usefull ?

2011-07-07 Thread Jim Peters
bly come up with a better example, but the compiler could in theory transform this: y = x++; z = y * y; into this: z = x++ * x++; But that would be a mistake. You need to hold that intermediate 'y' value somewhere to avoid doing x++ twice. So some temporary variables are always

Re: [Vala] Why the temporary variables in the C code are usefull ?

2011-07-07 Thread Jim Peters
ude function calls and stuff which modifies variables, e.g. p++. You don't want to do 'p++' twice or call the function twice. As the other poster said, C compilers are very good at optimising away temporary variables. Jim -- Jim Peters (_)/=\~/_(_)

Re: [Vala] lexical analysis using libvala

2011-06-18 Thread Jim Peters
k that a flag that controls whether or not all comments are stored in the AST would not create any significant overhead when turned off for compiling. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net

Re: [Vala] Gtk.Entry issue

2011-04-10 Thread Jim Peters
ork very well for you. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(_)http:// in Peru(_) /=\ ~/_ _

Re: [Vala] Problem creating a Source subclass with closures

2011-04-05 Thread Jim Peters
41, so it won't get forgotten. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(_)http:// in Peru(_) /=\ ~/_

Re: [Vala] [PATCH] Implement alias functionality for 'using' directive

2011-04-04 Thread Jim Peters
s. It is bug #646713. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(_)http:// in Peru(_) /=\ ~/_ _

Re: [Vala] how can I get the number of unicode points in a string?

2011-04-04 Thread Jim Peters
asured in unichars: O(N) for each character fetch, O(N*N) in a loop Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\~/_(_)

Re: [Vala] [PATCH] Implement alias functionality for 'using' directive

2011-04-03 Thread Jim Peters
Jim Peters wrote: > Required to disambiguate symbol references in case of matches from > multiple 'using' statements. I've implemented the alias functionality missing from 'using'. It took 3 tries before I found a way that worked and didn't upset the exist

[Vala] [PATCH] Implement alias functionality for 'using' directive

2011-04-03 Thread Jim Peters
Required to disambiguate symbol references in case of matches from multiple 'using' statements. --- tests/namespaces/aliases.vala | 30 vala/valacodewriter.vala |6 ++- vala/valamemberaccess.vala| 26 +++ vala/valaparser.vala | 17 ++- vala/vala

[Vala] 'using' importing too many symbols

2011-04-02 Thread Jim Peters
ut 'aliases'. Would this solve the problem? I'm not sure it would, unless the alias overrides all other matches and resolves the ambiguity: e.g. would 'using Queue = Gee.Queue' solve my problem? Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net

Re: [Vala] Setting up a GLib main loop with custom Sources with Vala 0.11.7

2011-03-29 Thread Jim Peters
seem possible > > to get this value in Vala. So I pass 256 for now which is more than > > enough. > > A workaround I see here (but that would still be a hack), is to have a > new constant named SIZE in GLib.Source defined as (untested): > > [CCode (cn

[Vala] Setting up a GLib main loop with custom Sources with Vala 0.11.7

2011-03-28 Thread Jim Peters
enough about that. I haven't added a bug for this because I can't be 100% sure there isn't some trick to get this to work with the existing VAPI. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net

[Vala] Problem creating a Source subclass with closures

2011-03-25 Thread Jim Peters
like valid bugs. I think I can probably rewrite the code to run all my queues from a single Source, though, to avoid triggering this problem. Jim -- Jim Peters (_)/=\~/_(_) j...@uazu.net (_) /=\ ~/_ (_) Uazú (_)/=\

Re: [Vala] Immutable ref-counted objects?

2011-03-24 Thread Jim Peters
Jim Peters wrote: > Java has partial support for immutable GC'd objects by marking all > public variables in the class as 'final'. So long as all the > referenced objects are also immutable objects, then everything works > out. The objects can be freely passed ar

[Vala] Immutable ref-counted objects?

2011-03-23 Thread Jim Peters
Properties with get; private set;: seemed a little heavy for this, but maybe all the extra calls would optimise away? Is this the best approach? I'm sure I just have to find the right idiom. Thanks -- Jim P.S. I'm pleased to have found Vala. You've implemented a