Re: [julia-users] Proposed solution for writing Enums

2016-08-25 Thread Stefan Karpinski
They're still fairly informal:

   - https://github.com/JuliaLang/julia/issues/12139
   - https://github.com/JuliaLang/julia/issues/14052
   - https://github.com/JuliaLang/julia/issues/16878
   - https://github.com/JuliaLang/julia/issues/17115

Basically an extended issue proposing a design to solve a particular
problem.

On Wed, Aug 24, 2016 at 9:06 AM, Brian Rogoff  wrote:

> What's an example of a good Julep? I did some searching and couldn't find
> much. Is there a document somewhere about
> writing and submitting Julia Enhancement Proposals?
>
> On Tuesday, August 23, 2016 at 11:09:25 AM UTC-7, Stefan Karpinski wrote:
>>
>> On Tue, Aug 23, 2016 at 12:39 PM, Brian Rogoff  wrote:
>>
>>> It's a bit surprising that Julia doesn't have built in enums and a
>>> case/switch form. I'm glad that there's open
>>> issue https://github.com/JuliaLang/julia/issues/5410
>>> 
>>> to address the lack of case/switch. Is there any hope that
>>> we may see these (or at least the built in case/switch) in 1.0?
>>>
>>
>> It's certainly possible. The best way to make it happen is to write a
>> good Julep for how case/switch should behave and once there's general
>> agreement on the plan, make a PR to implement it.
>>
>


Re: [julia-users] Proposed solution for writing Enums

2016-08-24 Thread Brian Rogoff
What's an example of a good Julep? I did some searching and couldn't find 
much. Is there a document somewhere about
writing and submitting Julia Enhancement Proposals?

On Tuesday, August 23, 2016 at 11:09:25 AM UTC-7, Stefan Karpinski wrote:
>
> On Tue, Aug 23, 2016 at 12:39 PM, Brian Rogoff  > wrote:
>
>> It's a bit surprising that Julia doesn't have built in enums and a 
>> case/switch form. I'm glad that there's open
>> issue https://github.com/JuliaLang/julia/issues/5410 
>> 
>>  
>> to address the lack of case/switch. Is there any hope that
>> we may see these (or at least the built in case/switch) in 1.0?
>>
>
> It's certainly possible. The best way to make it happen is to write a good 
> Julep for how case/switch should behave and once there's general agreement 
> on the plan, make a PR to implement it. 
>


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
On Tue, Aug 23, 2016 at 12:39 PM, Brian Rogoff  wrote:

> It's a bit surprising that Julia doesn't have built in enums and a
> case/switch form. I'm glad that there's open
> issue https://github.com/JuliaLang/julia/issues/5410 to address the lack
> of case/switch. Is there any hope that
> we may see these (or at least the built in case/switch) in 1.0?
>

It's certainly possible. The best way to make it happen is to write a good
Julep for how case/switch should behave and once there's general agreement
on the plan, make a PR to implement it.


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Jacob Quinn
Julia indeed has built-in enums: Just below here in the docs:
http://docs.julialang.org/en/latest/stdlib/base/#Base.Val{c}

On Tue, Aug 23, 2016 at 10:51 AM, Evan Fields  wrote:

> @enum doesn't do what you want for enums?
>


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Evan Fields
@enum doesn't do what you want for enums?


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Brian Rogoff
It's a bit surprising that Julia doesn't have built in enums and a 
case/switch form. I'm glad that there's open
issue https://github.com/JuliaLang/julia/issues/5410 to address the lack of 
case/switch. Is there any hope that
we may see these (or at least the built in case/switch) in 1.0?

On Tuesday, August 23, 2016 at 5:57:20 AM UTC-7, Stefan Karpinski wrote:
>
> Oh, I see that you have: 
> https://groups.google.com/forum/#!topic/julia-users/fgzVlbGcw-o.
>
> On Tue, Aug 23, 2016 at 8:55 AM, Stefan Karpinski  > wrote:
>
>> The formatting on that came out pretty garbled. Can you repost with line 
>> breaks and such?
>>
>> On Mon, Aug 22, 2016 at 5:03 PM, Paul Sorensen > > wrote:
>>
>>> The following is my idea of writing enums that are better than the macro 
>>> because they give you a  typesafe way of passing them to a 
>>> functionbaremodule EnumNameimmutable enumnamex::UInt8end
>>> const Value_A = enumname(0)const Value_B = enumname(1)end# usage 
>>> examplebaremodule Colorimmutable colorx::UInt8endconst 
>>> Red = color(1)const Green = color(2)const Blue = color(3)const 
>>> White = color(4)const Black = color(5)endfunction 
>>> testColor(c::Color.color)println("A color was 
>>> passed")endtestColor(Color.Red)
>>>
>>
>>
>

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
Oh, I see that you have:
https://groups.google.com/forum/#!topic/julia-users/fgzVlbGcw-o.

On Tue, Aug 23, 2016 at 8:55 AM, Stefan Karpinski 
wrote:

> The formatting on that came out pretty garbled. Can you repost with line
> breaks and such?
>
> On Mon, Aug 22, 2016 at 5:03 PM, Paul Sorensen  wrote:
>
>> The following is my idea of writing enums that are better than the macro
>> because they give you a  typesafe way of passing them to a
>> functionbaremodule EnumNameimmutable enumnamex::UInt8end
>> const Value_A = enumname(0)const Value_B = enumname(1)end# usage
>> examplebaremodule Colorimmutable colorx::UInt8endconst
>> Red = color(1)const Green = color(2)const Blue = color(3)const
>> White = color(4)const Black = color(5)endfunction
>> testColor(c::Color.color)println("A color was
>> passed")endtestColor(Color.Red)
>>
>
>


Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
The formatting on that came out pretty garbled. Can you repost with line
breaks and such?

On Mon, Aug 22, 2016 at 5:03 PM, Paul Sorensen  wrote:

> The following is my idea of writing enums that are better than the macro
> because they give you a  typesafe way of passing them to a
> functionbaremodule EnumNameimmutable enumnamex::UInt8end
> const Value_A = enumname(0)const Value_B = enumname(1)end# usage
> examplebaremodule Colorimmutable colorx::UInt8endconst
> Red = color(1)const Green = color(2)const Blue = color(3)const
> White = color(4)const Black = color(5)endfunction
> testColor(c::Color.color)println("A color was
> passed")endtestColor(Color.Red)
>


[julia-users] Proposed solution for writing Enums

2016-08-23 Thread Paul Sorensen
The following is my idea of writing enums that are better than the macro 
because they give you a  typesafe way of passing them to a 
functionbaremodule EnumNameimmutable enumnamex::UInt8end
const Value_A = enumname(0)const Value_B = enumname(1)end# usage 
examplebaremodule Colorimmutable colorx::UInt8endconst 
Red = color(1)const Green = color(2)const Blue = color(3)const 
White = color(4)const Black = color(5)endfunction 
testColor(c::Color.color)println("A color was 
passed")endtestColor(Color.Red)