Forums

how to use listen stmts

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

how to use listen stmts

Postby miked » Mon Feb 11, 2008 8:43 am

Hi Chuck,

You've captured in one place so many of the language features that I've wanted. Thanks! I'm thinking about doing a decent sized project in Cobra, but I have two questions:

1) do you have a time frame as to when you'll have first-class functions?
2) can you post a simple example of a Windows form with a button and a click event handler? I;ve got a form working, but I'm not clear on how to get the listen stmt to work with it.

Thanks.
miked
 
Posts: 5

Re: how to use listen stmts

Postby Charles » Mon Feb 11, 2008 11:01 am

You're welcome.

Time frame on first-class functions: probably last week of Feb or first week of March. I'd like to have them done by yesterday, but there a few bugs to squash and some source to open.

WinForms example. I'll try to get to this later today, but maybe it would help if I published the existing test case so you can at least see the syntax in a program that executes.

use System.ComponentModel

class Test

var _visited as bool

def main is shared
Test().run

def run
assert not _visited
using c = Component()
listen c.disposed, ref .componentDisposed
assert _visited

_visited = false
using c = Component()
listen c.disposed, ref _componentDisposed
assert _visited

def componentDisposed(sender as Object, args as EventArgs)
_visited = true

def _componentDisposed(sender as Object, args as EventArgs)
_visited = true
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: how to use listen stmts

Postby jonathandavid » Wed Nov 05, 2008 3:32 am

Time frame on first-class functions: probably last week of Feb or first week of March. I'd like to have them done by yesterday, but there a few bugs to squash and some source to open.



Hi,

Is this first-class functions already implemented? I browsed the docs but couldn't find any info.
jonathandavid
 
Posts: 159

Re: how to use listen stmts

Postby Charles » Wed Nov 05, 2008 3:53 am

For starters see:

-- How To Pass References to Methods

-- How To Use Win Forms

For storing references to methods in variables, or taking them as parameters, see:

-- Cobra 0.7.4 Release Notes

If you have a Subversion workspace, you can browse test cases under <workspace>\Tests\220-delegates-etc

If you have further questions after reviewing the above material, let us know.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: how to use listen stmts

Postby jonathandavid » Sat Nov 08, 2008 9:27 am

Chuck wrote:For starters see:

-- How To Pass References to Methods

-- How To Use Win Forms

For storing references to methods in variables, or taking them as parameters, see:

-- Cobra 0.7.4 Release Notes

If you have a Subversion workspace, you can browse test cases under <workspace>\Tests\220-delegates-etc

If you have further questions after reviewing the above material, let us know.


Thanks. What about other features of functional programming such as currying, lambdas, closures? Any plans for implementing those?

BTW, I really like what I've seen of Cobra so far. I plan to start a little project using Cobra soon, I'll keep you informed of any bugs or suggestions that pop up.
jonathandavid
 
Posts: 159

Re: how to use listen stmts

Postby Charles » Sat Nov 08, 2008 2:05 pm

I definitely plan on implementing lambdas and closures. Not planning on implementing currying at this time.

Feedback is always appreciated.

Be sure to use Cobra out of the source code repository. There is a handy install-from-workspace script in the Source directory and we have an extensive automated regression test suite, so it tends to be fairly stable.

-Chuck
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 92 guests

cron