Euphoria Ticket #892: type enum return 1

As a implementation detail, the enum types return which place they were in their declaration. It is better they return 1. This way most enum types can be implemented more efficiently:

Consider this code:

type enum boolean 
     FALSE = 0, 
     TRUE 
end type 
 
boolean k 
 
? boolean( 5 = 5 ) 

The code generated for the last line is equivalent to:

? find( 5 = 5, { FALSE, TRUE } ) 

This is fine for short lists but for long lists its less efficient than:

temp = 5=5 
? integer(temp) and FALSE<=temp and temp<=TRUE 

Details

Type: Feature Request Severity: Minor Category: Language
Assigned To: unknown Status: New Reported Release:
Fixed in SVN #: View VCS: none Milestone: 4.1.0

1. Comment by SDPringle May 18, 2014

See: hg:euphoria/rev/4be0ecb29c04

changeset: 6211:4be0ecb29c04 branch: alternative_literals tag: tip parent: 6205:825c2da43311 user: Shawn Pringle <shawn.pringle@gmail.com> date: Sun May 18 08:09:36 2014 -0300 files: docs/refman_2.txt source/parser.e tests/manual/t_traced_enum_type.e tests/t_enum_type.e tests/t_literals.e description:

  • make user defined type enum return 1
  • ticket 892

Search



Quick Links

User menu

Not signed in.

Misc Menu