Calling a types method dynamically

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

Calling a types method dynamically

Jolle Carlestam-2
This code example doesn’t work. But I’m pretty sure I’ve seen ways to do it. Anyone with an working version?

define mytype => type {


        public monday => 'Mundane'
        public tuesday => 'Tuna day'
        public wednesday => 'Why day'
        public thursday => 'Thurstay'
        public friday => 'Free day'
        public saturday => 'Sad day'
        public sunday => 'Sunky day'

}

local(mydays = (:
        'tuesday',
        'thursday'
        'saturday'
))

with day in #mydays
select mytype->#day // <- This fails


Lasso 9.3ish

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Calling a types method dynamically

Bil Corry-3
Ke has an answer for that!

Calling methods dynamically:

http://www.lassotalk.com/Re-L9-assignment-to-self.lasso?268280

Calling threads dynamically:

http://www.lassotalk.com/Re-Dynamic-thread-names.lasso?278795


- Bil


On Thu, Jan 18, 2018 at 2:57 AM, Jolle Carlestam <[hidden email]>
wrote:

> This code example doesn’t work. But I’m pretty sure I’ve seen ways to do
> it. Anyone with an working version?
>
> define mytype => type {
>
>
>         public monday => 'Mundane'
>         public tuesday => 'Tuna day'
>         public wednesday => 'Why day'
>         public thursday => 'Thurstay'
>         public friday => 'Free day'
>         public saturday => 'Sad day'
>         public sunday => 'Sunky day'
>
> }
>
> local(mydays = (:
>         'tuesday',
>         'thursday'
>         'saturday'
> ))
>
> with day in #mydays
> select mytype->#day // <- This fails
>
>
> Lasso 9.3ish
>
> HDB
> Jolle
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Calling a types method dynamically

Jolle Carlestam-2
Ah, of course. Ke, the double black belt Lasso Zen-master.
Excellent, I knew there was a backslash involved somehow.

Thanks!

HDB
Jolle

> 19 jan. 2018 kl. 00:11 skrev Bil Corry <[hidden email]>:
>
> Ke has an answer for that!
>
> Calling methods dynamically:
>
> http://www.lassotalk.com/Re-L9-assignment-to-self.lasso?268280
>
> Calling threads dynamically:
>
> http://www.lassotalk.com/Re-Dynamic-thread-names.lasso?278795
>
>
> - Bil
>
>
> On Thu, Jan 18, 2018 at 2:57 AM, Jolle Carlestam <[hidden email]>
> wrote:
>
>> This code example doesn’t work. But I’m pretty sure I’ve seen ways to do
>> it. Anyone with an working version?
>>
>> define mytype => type {
>>
>>
>>        public monday => 'Mundane'
>>        public tuesday => 'Tuna day'
>>        public wednesday => 'Why day'
>>        public thursday => 'Thurstay'
>>        public friday => 'Free day'
>>        public saturday => 'Sad day'
>>        public sunday => 'Sunky day'
>>
>> }
>>
>> local(mydays = (:
>>        'tuesday',
>>        'thursday'
>>        'saturday'
>> ))
>>
>> with day in #mydays
>> select mytype->#day // <- This fails
>>
>>
>> Lasso 9.3ish
>>
>> HDB
>> Jolle


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Calling a types method dynamically

Jolle Carlestam-2
For future reference. Here’s the adjusted, working code:

define mytype => type {

        public monday => 'Mundane'
        public tuesday => 'Tuna day'
        public wednesday => 'Why day'
        public thursday => 'Thurstay'
        public friday => 'Free day'
        public saturday => 'Sad day'
        public sunday => 'Sunky day'

}

local(mydays = (:
        'tuesday',
        'thursday',
        'saturday'
))

with day in #mydays
let daytag = tag(#day)
select mytype->\#daytag()


-> Tuna day, Thurstay, Sad day

HDB
Jolle

> 19 jan. 2018 kl. 04:45 skrev Jolle Carlestam <[hidden email]>:
>
> Ah, of course. Ke, the double black belt Lasso Zen-master.
> Excellent, I knew there was a backslash involved somehow.
>
> Thanks!
>
> HDB
> Jolle
>
>> 19 jan. 2018 kl. 00:11 skrev Bil Corry <[hidden email]>:
>>
>> Ke has an answer for that!
>>
>> Calling methods dynamically:
>>
>> http://www.lassotalk.com/Re-L9-assignment-to-self.lasso?268280
>>
>> Calling threads dynamically:
>>
>> http://www.lassotalk.com/Re-Dynamic-thread-names.lasso?278795
>>
>>
>> - Bil
>>
>>
>> On Thu, Jan 18, 2018 at 2:57 AM, Jolle Carlestam <[hidden email]>
>> wrote:
>>
>>> This code example doesn’t work. But I’m pretty sure I’ve seen ways to do
>>> it. Anyone with an working version?
>>>
>>> define mytype => type {
>>>
>>>
>>>       public monday => 'Mundane'
>>>       public tuesday => 'Tuna day'
>>>       public wednesday => 'Why day'
>>>       public thursday => 'Thurstay'
>>>       public friday => 'Free day'
>>>       public saturday => 'Sad day'
>>>       public sunday => 'Sunky day'
>>>
>>> }
>>>
>>> local(mydays = (:
>>>       'tuesday',
>>>       'thursday'
>>>       'saturday'
>>> ))
>>>
>>> with day in #mydays
>>> select mytype->#day // <- This fails
>>>
>>>
>>> Lasso 9.3ish
>>>
>>> HDB
>>> Jolle
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>