Ticket #138 (closed enhancement: wontfix)

Opened 1 year ago

Last modified 1 year ago

Expression-scoped pragmas

Reported by: lth Assigned to: jeffdyer
Type: enhancement Priority: major
Milestone: M2 Component: Proposals
Version: 4 Keywords:
Cc: brendan, jeffdyer

Description

Motivation: The number pragmas are our main mechanism for invoking a particular kind of operator, particularly for int and uint. But they are block scoped only -- so code that wants to invoke two different kinds of operators (say, code adding the elements of an array of generic numbers) must structure their code somewhat elaborately with temporaries and multiple blocks.

It would be simple for us to add expression-scoped number pragmas, and I think we should.

The syntax would be:

let (use <pragma>, ...) expression

Example:

let (use int) a+b

is exactly the same as

(function () { use int; return a+b })()

Some other pragmas could usefully be adopted under this umbrella: namespace, rounding, and precision for sure:

let (use namespace intrinsic, decimal, precision=20) a+b

The exact set of allowed pragmas: TBD.

Attachments

Change History

Changed 1 year ago by lth

See longer discussion with samples here: https://intranet.mozilla.org/ECMA/wiki/doku.php?id=discussion:numbers. Please annotate that page, do not comment here.

Changed 1 year ago by jeffdyer

  • owner set to jeffdyer
  • component changed from Proposals to RefImpl
  • milestone set to M2

Accepted at Yahoo! meeting. Moving to RI bug.

Changed 1 year ago by lth

  • priority changed from minor to major
  • component changed from RefImpl to Proposals

Not obvious this is needed any more, since the number pragmas have been removed. Reverting to proposal stage for reconsideration at future meeting.

Changed 1 year ago by lth

Specifically, I propose that we remove expression-scoped pragmas from the language.

Changed 1 year ago by lth

  • status changed from new to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.