Viktoras, you can effectively hide the array manipulations in a library stack. I've done this quite a lot, though haven't really thought of it as OOP-like, though it produces at least some kind of 'encapsulation'. One could think of the library stack as being the place where you define 'classes'.

Just off the top of my head, the script of the library 'class' stack might look like this :

local sCities
local sCityProperties = "country,continent,population,area,isNationalCapital,hasAirport"

on setCity pCity, pProp, pVal
if pProp is among the items of sCityProperties then put pVal into sCities[pCity, pProp]
end setCity

function getCity pCity, pProp
  if pProp is empty then put "all" into pProp

  switch pProp
  case "all"
    return allCityData(pCity)
    break
  case "populationDensity"
    return popDensity(pCity)
    break
  default
   return sCities[pCity, pProp]
   break
  end switch
end getCity

function allCityData pCity
  put the keys of sCities into tKeys
  filter tKeys with pCity & "*"
  repeat for each line L in tKeys
    put item 2 of L & "=" & sCities[L] & cr after tCityData
  end repeat
  put popDensity(pCity) after tCityData
  return tCityData
end allCityData

function popDensity pCity
  return sCities[pCity, population] / sCities[pCity, "area"]
end popDensity

and so-on....

so then in the main app, you'd do things like :

setCity "London", "country", "UK"
setCity "London", "population", 8000000

if getCity("London", "populationDensity") > 34 then....
put getCity("London")

which is sort of equivalent to :
London.population = 8000000
if London.populationDensity > 34 then....

Forgive me if this is all stuff you've already done, but it's certainly helped me think about it a bit!

Best,

Mark


On 19 Mar 2008, at 14:19, viktoras didziulis wrote:

Hi,

me too like rOOP, but I feel it is a little incomplete, just one more step. The ones that you call real objects are limited to user interface controls only. The thing I was curious about is a possibility to create an independent data object which is nor control neither a gui element. Which in this case may simply mean enhanced arrays...

What for ?. I think this would make code cleaner and reduce amount of commenting in larger projects.. Also facilitate creation or adoptions of existing libraries in C or C++ for very specific purposes - like reading shapefiles, netcdfs, doing geographical transformations, astronomy, bioinformatics, etc... This consequently will increase the scope of applications that can be created in Rev and hopefully availability of diverse libraries.

In general it would make creation of complex software easier. We can already simulate objects using arrays, but at least the code would be more readable (!!!) if I were able to distinguish array operations from object manipulations.

Best wishes
Viktoras



Mark Schonewille wrote:
Hi,

I just don't get it. I never ever felt a need for OOP and I just can't imagine I ever will, using xTalks. I'd call xTalk rOOP (really object oriented programming) because xTalk uses real objects, like fields, buttons, etc.

Why don't you simply forget about OOP? What does OOP have that rOOP doesn't?

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software. Download at http://www.salery.biz

Op 19-mrt-2008, om 13:25 heeft viktoras didziulis het volgende geschreven:

I would like to define a class, an object (the both with their properties) and methods that are not a part of graphical user interface or Revolution engine...

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to