I had already begun work as a side project on my own of developing what I’m calling the Standard Component (Class?) Library. It would be something along the lines of C++'s stdlib, or PHP’s Standard PHP Library. My thoughts are that it would be primarily some base interfaces/classes, but also could become an object-oriented “porcelain” (to borrow from Git) to current BIF capability.
I bring this up, as it is somewhat intrinsic to the reply I posted on the Rename the function JavaNew topic. I just want to throw it out there as possibly something I could turn over at some point to be a core language library (assuming something like this is not already in the works). I hope to have some code out on github soon.
Just by way of some examples:
import scl.Iterable;
import scl.Countable;
class NonIteratingIterable implements=Iterable,Countable {
public boolean function hasNext() { return false; }
public any function next() { return; }
public any function current() { return; }
public numeric function length() { return 0; }
}
import scl.query.Query;
resultSet = Query::execute("select * from someTable", [], {dataSource="mydsn"});
stmt = Query::prepare("select * from someTable where id = :id", "mydsn");
resultSet = stmt.execute({id: 1});
// resultset implements iterable
while(resultSet.hasNext()) {
dump(resultSet.next());
}
// the query object is still available:
for (row in resultSet.getData()) {
}
// could even do Linq-type queries...
result = LinqQuery::from([
{id: 1, firstName: 'Jesse', lastName:'Shaffer'}
]).select({
fullName: '${firstName} ${lastName}'
});
// result now holds [{fullName:"Jesse Shaffer"}]