Jira (PUP-10944) Enum.new

18 views
Skip to first unread message

Nodøn

unread,
Mar 1, 2021, 11:29:03 AM3/1/21
to puppe...@googlegroups.com
Nodøn created an issue
 
Puppet / New Feature PUP-10944
Enum.new
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: Type System
Created: 2021/03/01 8:28 AM
Priority: Normal Normal
Reporter: Nodøn

helindbe and I had a chat in the slack today: https://puppetcommunity.slack.com/archives/C0W298S9G/p1614611196389300

The result of it is, that it would be nice to be able to `Enum.new`:

Boolean function parameter: Enum['apple', 'banana'](false) -> 'apple'

Integer function parameter: Enum['apple', 'banana', 'orange'](2) -> 'orange'

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Nodøn

unread,
Mar 2, 2021, 6:53:56 PM3/2/21
to puppe...@googlegroups.com
Nodøn updated an issue
Change By: Nodøn
{{helindbe and I had a chat in the slack today: [https://puppetcommunity.slack.com/archives/C0W298S9G/p1614611196389300]}}

{{The result of it is, that it would be nice to be able to `Enum.new`:}}

{{Boolean function parameter: Enum['apple', 'banana'](false) -> 'apple'}}

{{Integer function parameter: Enum['apple', 'banana', 'orange'](2) -> 'orange'}}

@Docs When the code is written, the `new` functions documentation needs to be updated. It has to list Enum.new and maybe show a little example. Similar to https://puppet.com/docs/puppet/latest/function.html#conversion-to-string

Henrik Lindberg (Jira)

unread,
Mar 2, 2021, 7:23:56 PM3/2/21
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-10944
 
Re: Enum.new

The Enum data type does not support new at the moment and would be easy to add without any consequences. It makes sense to be able to create a string from an enumeration based on Boolean or Numeric. It should error if the converted value leads to an index out of range for the enum.

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:28:56 PM3/2/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Labels: community

Nodøn

unread,
Mar 2, 2021, 7:28:56 PM3/2/21
to puppe...@googlegroups.com
Nodøn updated an issue

When the code is written, the `new` functions documentation needs to be updated. It has to list Enum.new and maybe show a little example.

Add Comment Add Comment
 

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:28:56 PM3/2/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Team: Night's Watch

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:28:57 PM3/2/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Labels: community help_wanted

Nodøn

unread,
Mar 2, 2021, 7:33:56 PM3/2/21
to puppe...@googlegroups.com
Nodøn updated an issue
Change By: Nodøn
Comment:
When the code is written, the `new` functions documentation needs to be updated. It has to list Enum.new and maybe show a little example.

Nodøn

unread,
Mar 2, 2021, 7:33:57 PM3/2/21
to puppe...@googlegroups.com
Nodøn updated an issue
 
Puppet / New Feature PUP-10944
Enum.new
Change By: Nodøn
{{helindbe and I had a chat in the slack today: [https://puppetcommunity.slack.com/archives/C0W298S9G/p1614611196389300]}}

{{The result of it is, that it would be nice to be able to `Enum.new`:}}

{{Boolean function parameter: Enum['apple', 'banana'](false) -> 'apple'}}

{{Integer function parameter: Enum['apple', 'banana', 'orange'](2) -> 'orange'}}


@Docs When the code is written, the `new` functions documentation needs to be updated. It has to list Enum.new and maybe show a little example.

Nodøn

unread,
Jul 23, 2021, 7:41:04 AM7/23/21
to puppe...@googlegroups.com
Nodøn commented on New Feature PUP-10944
 
Re: Enum.new

I tried something and I do have no idea if it works or probably it doesn't: https://github.com/puppetlabs/puppet/pull/8710

This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages