On Fri, 31 Mar 2017 16:00:52 +0900 Conrad Um <con...@gmail.com> said:

> This is similar to bu5hm4n's idea, but a little different. (Not pass by
> value, but reference)
> http://www.mail-archive.com/enlightenment-devel@lists.sourceforge.net/msg82744.html
> 
> While studying oop, I found that properties are usually expressed as struct
> or object instead of multiple arguments.
> 
> For example, "size" property usually accepts Size struct.
>     public struct  Size {
>         int width;
>         int height;
>     }
>     obj.size = new Size(100, 100); // This means "obj.setSize(new Size(100,
> 100));"
> 
> In languages supporting property accessor expression like C# or Vala,
> multiple arguments cannot be expressed with that syntax. I think it is
> better to exchange a set of data in the type of object (or struct, it can
> be considered as simplified object).
> 
> Former example can be translated into the next.
>     Size size = { 100, 100 };
>     size_set(obj, &size);
> 
> I know "size_set(obj, 100, 100)" is more simpler, but handling related
> variables with one set is more reasonable in point of oop. (Or we can add c
> wrapper function like calling eo API by legacy API for more simple function
> signature)
> 
> What do you think of this?

i've thought about this before, and realistically using such structs for size,
geometry, color etc. just is more of a pain than a gain. it theoretically looks
nice but it just becomes far more of a pain in real life to use. in general
code gets longer and more verbose, not nicer.

> Regards,
> Jeeyong Um (conr2d)
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to