Al 10/05/12 12:06, En/na Jukka Lehtosalo ha escrit:
> On Thu, May 10, 2012 at 10:20 AM, Xan xan<
xanc...@gmail.com> wrote:
>>
>> 2012/5/10 Jukka Lehtosalo<
jleht...@gmail.com>
> ...
>>> Thanks for the pointer. Actors are probably better than plain threads
>>> for most programs, but it's still not obvious what's the best way of
>>> implementing them in Alore. Threads are simply too error-prone and
>>> difficult to test/debug, especially in larger projects with multiple
>>> programmers and a lot of (potentially) shared state.
>>
>> You're welcome.
>> Another way of doing concurrency is pipes, like Go does. It has the benefits
>> that we could do concurrency without classes, just main function and pipes,
>> and actors require classes and not always you want classes....
>>
>> I think that the Actors could be implemented as a library on top of pipes.
>> With this approach, you have user comfortable syntax and core-without-class
>> (means more generally) code written in pipes....
> Yep, it would be useful to have pipes/message queues as a low-level
> interface. There could be multiple higher-level actor class libraries
> built on top of the low-level interface to choose from.
>
>> Do you think about concurrency model in Alore? This is a critical feature.
>> There are few too many langs with this feature. A good concurrency language
>> could have a star language ;-)
> I've been thinking about this quite a lot, and I think an actor-style
> programming model + low-level interface based on message passing
> between threads with isolated heaps might work well. Some applications
> might need data structures shared across actors/threads, though, but
> shared-nothing (data) would be a good default.
Yes. We coincide on this. I have a pain not contributing to the code,
because I just a mere user. I don't have technical skills to program a
decent concurrent library for alore. I'm sorry.
>>>> By the other hand, really, your previous idea is good: define a Map<Str,
>>>> Int> of number of instances of each class. This works:
>>>>
>>>> var instances = Map<Str, Int>()
>>>> instances["Task"] = 0
>>>>
>>>> and self.num = instances["Task"]
>>>>
>>
>> What about that? Why this code does not work and var instances = Map() does?
> Ah, missed this one. You can do it like this:
>
> var instances = Map() as<Str, Int>
>
> You need the "as<...>" since otherwise the syntax would be ambiguous
> (it could be parsed as (Map< Str), (Int> ()) ).
>
> Jukka
Ah!, thanks.
Xan.