Constants and the Playground

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Constants and the Playground

Thibault Raffaillac
Hi,

My work on OpenGL ES is almost done, and I am now trying to play with it in the Playground. However, since constants are stored in a pool dictionary you have to create a class importing it to encapsulate your OpenGL calls, so cannot just write snippets in Playground. This is very annoying for prototyping, so is there a good common design pattern to be able to use constants there ?

Cheers,
Thibault

Reply | Threaded
Open this post in threaded view
|

Re: Constants and the Playground

stepharo


Le 15/4/16 18:28, Thibault Raffaillac a écrit :
> Hi,
>
> My work on OpenGL ES is almost done,

Cool I'm curious if we could have an Athens backend based on it :)
>   and I am now trying to play with it in the Playground. However, since constants are stored in a pool dictionary you have to create a class importing it to encapsulate your OpenGL calls, so cannot just write snippets in Playground. This is very annoying for prototyping, so is there a good common design pattern to be able to use constants there ?

What you could do is to generate class methods for each of the classvariable
in pseudo code

OpenGL classVariables do:  [:each |
     OpenClass class compiled: each name, ' ^ ',  each name classified:
accessing ]

this way you can do

OpenGL MyConstant in the playground
>
> Cheers,
> Thibault
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Constants and the Playground

Thibault Raffaillac
In reply to this post by Thibault Raffaillac
> What you could do is to generate class methods for each of the classvariable
> in pseudo code
>
> OpenGL classVariables do:  [:each |
>      OpenClass class compiled: each name, ' ^ ',  each name classified:
> accessing ]
>
> this way you can do
>
> OpenGL MyConstant in the playground

Problem is I have class methods in the same class, so this would make them hard to browse. I thought about implementing name search in the class DNU, but constants would not benefit from syntax coloring/completion then.
Can we import Pool Dictionaries in the Playground?

Thibault

Reply | Threaded
Open this post in threaded view
|

Re: Constants and the Playground

Marcus Denker-4

> On 17 Apr 2016, at 10:43, Thibault Raffaillac <[hidden email]> wrote:
>
>> What you could do is to generate class methods for each of the classvariable
>> in pseudo code
>>
>> OpenGL classVariables do:  [:each |
>>     OpenClass class compiled: each name, ' ^ ',  each name classified:
>> accessing ]
>>
>> this way you can do
>>
>> OpenGL MyConstant in the playground
>
> Problem is I have class methods in the same class, so this would make them hard to browse. I thought about implementing name search in the class DNU, but constants would not benefit from syntax coloring/completion then.
> Can we import Pool Dictionaries in the Playground?
>
>

I think it would be possible (and even not that hard) to add some “import” for Pools to playground.
One would not do that by default, but there could be a UI (or an API) to configure a playground
specially for scripting e.g. OpenGL with all the class vars pre-bound.

        Marus