[Developers] Perl API - just to make things confusing

Tim Sturge tsturge at metaweb.com
Fri Aug 24 20:55:23 UTC 2007


Firstly thanks to everyone (Kirrily, Michael, Hayden) for working on this.

I'm aware of the issue that some dynamic languages (python) distinguish 
quite strongly between string, int and float, some (javascript) between 
string and number and others (perl, PHP) don't really distinguish any of 
them. (The question mostly boils down to whether "55"+"11" is "5511" or 66).

JSON distinguishes between string and number (as it is built on 
Javascript) and MQL distinguishes floats from integers (although it does 
automatically promote integers to floats when necessary). JSON and MQL 
also distinguish the boolean true as distinct from the integer 1 and the 
boolean false as distinct from the integer 0

I'm wondering how much difficultly that will cause in Perl and PHP (not 
languages I have interfaced MQL to myself, but languages that we at 
Metaweb are 100% committed to working well with Freebase). So please let 
me know how this ends up working; I don't want MQL to impose unnecessary 
barriers to Perl (or PHP) users and if we need a "perl mode" then I 
would be willing to consider what its requirements would be.

Tim

Michael Jones wrote:
> I haven't been able to look at Kirrily's work yet, but I like the
> direction Hayden is going.  The syntax and method structure are
> extremely functional and I don't have a lot to add to the basic
> query/response methods.  Nice work you two!
>
> I do have a minor caveat.  When I wrote my metaweb module, I ran into
> an issue with the JSON serializer where "name" property values that
> consist only of numbers (as in topics that are named after years, i.e.
> '2007') would not be quoted, and Metaweb would issue an error because
> it expected a string.  If you're using the JSON.pm Perl library,
> you'll likely face the same issue.  I patched it by simply using a
> substitution for name property values in the JSON string, but a more
> generalized approach is called for.
>   



More information about the Developers mailing list