Re: [Vala] vala libgda LINQ



2013/12/4 Luca Bruno <lethalman88 gmail com>

LINQ is just some kind of syntax for some functional programming aspects.
It's about to be a 1:1 mapping with filter-map, also fold and scan..

For example:
select field1,field2 from collection where field3==value
can be written as:
collection.filter((r) => r.field3==value).map((r) => {r.field1, r.field2});
Obviously, LINQ is not only that, but that's a good approximation.


Vala has provide nice/sexy syntax for GObject/C programing. Have added lot
of new features, witch have been possible to write in C but with lot of
lines of code. I love Vala because allows me to be more productive, even
Genie allows more simplification on Vala's syntax.

I think that former syntax are more productive and easy to read than the
last. Could allow to work with-in Vala's code with lot of data from a
DataBase or any other data source. GdaData objects and interfaces allows to
access that data using just GObjects and Vala code, abstracting most of
internal operations and mapping to properties and methods, and allow to use
Gee collections to make more easy to access to data using by code; but
could reach a next level by adding some syntax support on Vala for SQL like
queries.

I know that adding syntax support may is not easy or is far from Vala
principles.

Then I would like to see a way to allows Vala compiler with a mechanism of
PLUG-INS for syntax support. Then GdaData could add its own plug-in for SQL
syntax when it is installed.

The above allows not to distract Vala from its principles, but allows to
others add syntax for specific task that makes more easy/productive and
clear way to do the same.

Less code and clear syntax, allows more productive less errors.


That said, implement filter, map and fold in your collections library and
you can avoid the LINQ syntax :-)
Consider libgee has filter, map, fold and scan with which you can
implement a large subset of LINQ, including aggregate operators.
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list




-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los
cuates: LIBRE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]