Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#26 4-Nov-2014 21:47:25

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Does the VM have a callback for changing tablet orientation

You can not call cbTick with its "normal" type from another part of code in a given environment.

that's a point I will try to remember...

Offline

#27 4-Nov-2014 21:58:52

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Does the VM have a callback for changing tablet orientation

This code is incorrect. The VM will crash :

typeof tmrMain = Timer;;
typeof tmrMainOther = Timer;;

fun cbTick(tmr, pri_param, tupleParams) =
  // any code

fun main() = 
   _showconsole;
   _fooS "***********************************";

   set tmrMain = _starttimer _channel 100;
   set tmrMainOther = _starttimer _channel 500;

   _rfltimer tmrMain mkfun3 @cbTick "primary_param" ["secondary_param_3" "secondary_param_2" "secondary_param_1"];
   _rfltimer tmrMainOther @cbTick "other_param";

   _fooS "***********************************";
   0;;

I create two timers, it's ok. But i define the same callback : for the first timer with mkfun3, for the second, without mkfun3.
In the first case, cbTick must have this type : fun [Timer S [S S S]] u0
In the second case,  cbTick must have the type : fun [Timer S] u0
In Scol, a function can not have two different types, you can not overload a function.

Offline

#28 7-Nov-2014 11:00:37

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Does the VM have a callback for changing tablet orientation

About this (to call a function, mkfun, ...), i've written that on the wiki, i've forgotten ...

http://redmine.scolring.org/projects/tu … ct_in_Scol
http://redmine.scolring.org/projects/tu … ion_object

Offline

Board footer

Powered by FluxBB