[racket] I'd use an object for this in PHP, how do I handle it in racket?
You could put all the context information in a struct and pass that
around instead. But sometimes objects are just neater. Here's some code
I wrote for the oauth2 protocol:
https://github.com/rmculpepper/webapi/blob/master/oauth2.rkt
I like the objects version more than the first version I wrote.
Ryan
On 11/04/2011 10:28 AM, Jordan Schatz wrote:
> I'm making an API wrapper for the WebDriver wire protocol:
> http://code.google.com/p/selenium/wiki/JsonWireProtocol#Command_Detail
>
> In general all of the API calls require me to pass back to the server a
> token (:sessionId in the spec) that is unique to the current instance. In
> PHP or some "other" language I would create the wrapper as an object, and
> store the token in a private property. I know racket has full support for
> classes and objects, but using an object here doesn't feel like racket's
> style.
>
> How do I write it without using an object? What is best practice?
>
> If it matters I'm likely to have 10-100 instances / threads of this
> running in parallel at a time... as many as I can fit on a machine.
>
> Shalom,
> Jordan
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users