Lasso Soft Inc. > Home

RhinoTrac

LassoSoft Ticket Tracking System

NOTE: If you are using Lasso Server 9.3 please Log your ticket directly via the LUX admin as this will give us more information about your issue.

Lasso 9 Issues



Ticket #7994: Allow automatic calling of invoke() on thread objects

Reported by:
Eric Knibbe
Date:
19 Sep, 2015
Priority:
minor
Component:
Lasso 9
Version:
9.3
Keywords:
Platform:
With types, invoke() is automatically called if parens are appended to a variable containing an instance of a type.
define a_type => type {
public invoke() => { return 'invoked!' }
}

a_type()
// a_type
a_type->invoke
// invoked!
local(a = a_type)
#a()
// invoked!

With thread objects,
define counter_thread => thread {
data private val = 0
public invoke(value::integer) => {
.val += #value
stdoutnl(.val)
}
}

invoke() is still called if done through a variable,
var(c = counter_thread)
$c->invoke(10)
// 10
$c(10)
// 20

but if called by name, it needs to be called with an extra set of parens.
counter_thread->invoke(10)
// 30
counter_thread()(10)
// 40
counter_thread(10)
// Definition Not Found: counter_thread(integer) Candidates were: counter_thread()

Is it possible to make syntax like `counter_thread(10)` automatically call `counter_thread->invoke(10)`?
Please log in to your LassoSoft account to comment

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft