Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add Select/Case construct #858

Closed
DartBot opened this issue Dec 14, 2011 · 4 comments
Closed

Please add Select/Case construct #858

DartBot opened this issue Dec 14, 2011 · 4 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Dec 14, 2011

This issue was originally filed by jesse.ros...@gmail.com


Switch is C artifact that is non-declarative, low level, and in JavaScript, a major source of bugs.

High level languages should allow declarative self documenting code. VB has a very nice select/case that allows you to bypass else-if hell that is unnatural to how people intuitively think.

My best guess for the reason for this construct missing in new languages is every new language copies the last popular language that ultimately copied C. Basically, pass on the same bad idea and make real programmers jump though hoops.

I professionally code in C#, Java ,JavaScript and VB. I always miss this feature when I leave VB.

C# is funny, using switch, you must write a break statement even though it does nothing.

I would also like to suggest that only one statement be allowed for any case : block.

In any event, make up you mind: Is Dart a High level or low level language? Business application programmer would always vote for select/case.

Thanks for your time.

@DartBot
Copy link
Author

DartBot commented Dec 15, 2011

This comment was originally written by drfibonacci@google.com


Removed Type-Defect label.
Added Type-Enhancement, Area-Language, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented Dec 15, 2011

Set owner to @gbracha.
Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented May 3, 2012

Issue #892 has been merged into this issue.

@anders-sandholm
Copy link
Contributor

Our view is that the switch statement is a low-level table look-up.
We suggest using object dispatch for business logic.


Added WontFix label.

@DartBot DartBot added Type-Enhancement area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels May 8, 2012
@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug and removed resolution-wont_fix labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Jan 26, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

args (https://github.com/dart-lang/args/compare/04c9346..a23ea85):
  a23ea85  2023-01-25  Devon Carew  update the publishing script (#232)

dartdoc (https://github.com/dart-lang/dartdoc/compare/ed56883..99df16a):
  99df16a0  2023-01-24  Parker Lougheed  Use a sun for light theme toggle instead of moon (#3309)
  758e1851  2023-01-24  Parker Lougheed  Switch dart:js and some dart:js_util usages to use static interop (#3299)
  9735d895  2023-01-24  dependabot[bot]  Bump github/codeql-action from 2.1.38 to 2.1.39 (#3306)
  f6cd8eb9  2023-01-23  Sam Rawlins  Fix various bits in testing code to comply with new warnings (#3307)

http (https://github.com/dart-lang/http/compare/57c53b0..092bb2d):
  092bb2d  2023-01-25  Brian Quinlan  Create a `package:cronet_http/cronet_http.dart` import (#859)
  a62f5b3  2023-01-24  Brian Quinlan  Create a single top-level lib file. (#858)

intl (https://github.com/dart-lang/intl/compare/3fcc810..946c34c):
  946c34c  2023-01-25  Copybara-Service  Merge pull request #533 from dart-lang:updateVersion
  19b6785  2023-01-20  Moritz  Append `-dev` to current version

sse (https://github.com/dart-lang/sse/compare/be426a2..4e63b08):
  4e63b08  2023-01-25  Kevin Moore  Fix deprecated import to webdriver library (#76)

webdev (https://github.com/dart-lang/webdev/compare/f978b90..a347fa0):
  a347fa0  2023-01-25  Anna Gringauze  Update vm_service to version 10.0.0 (#1917)
  4dd29a5  2023-01-24  Anna Gringauze  Allow dart SDK <4.0.0 (#1913)
  b3db2c9  2023-01-24  Anna Gringauze  Prepare for dart 3.0 alpha changes: Handle SDK layout update (#1907)

Change-Id: I84d827db044f5b0af49b0454fd1d69b0d2ddf692
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279901
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Jun 29, 2023
…uf, test

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/e04a6b3..c2ed703):
  c2ed703c  2023-06-26  dependabot[bot]  Bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#3454)

ecosystem (https://github.com/dart-lang/ecosystem/compare/b1056e6..19fa443):
  19fa443  2023-06-29  Lasse R.H. Nielsen  Clean-up and tweaks of the firehose project. (#117)
  9ef5948  2023-06-27  Moritz  Excise health from firehose (#118)
  36c662e  2023-06-27  Moritz  Introduce a health checking workflow (#115)

http (https://github.com/dart-lang/http/compare/ff1fcfe..d68081f):
  d68081f  2023-06-26  Nate Bosch  Prepare to publish package:http (#973)
  067bff3  2023-06-26  Alex James  Create java http package (#971)

lints (https://github.com/dart-lang/lints/compare/79581ff..89f9519):
  89f9519  2023-06-28  Parker Lougheed  Fix typo in 3.0.0-wip changelog entry (#137)

markdown (https://github.com/dart-lang/markdown/compare/bd6ae8d..4674d09):
  4674d09  2023-06-27  Zhiguang Chen  Fix HtmlBlockSyntax (#548)

mockito (https://github.com/dart-lang/mockito/compare/1d6064a..974226e):
  974226e  2023-06-27  Googler  Internal change

protobuf (https://github.com/dart-lang/protobuf/compare/e76bd74..7bebbc6):
  7bebbc6  2023-06-29  Ömer Sinan Ağacan  Update protoc_plugin Makefile: (#858)
  acc0462  2023-06-29  Ömer Sinan Ağacan  Ignore non-items in message sets (#857)
  0eb3796  2023-06-29  Ömer Sinan Ağacan  Ignore unknown tags in message set items (#856)
  2996e1d  2023-06-27  Ömer Sinan Ağacan  Implement message set wire format (#836)

test (https://github.com/dart-lang/test/compare/cdc8178..021667a):
  021667a4  2023-06-28  Jacob MacDonald  prep to release (#2048)
  3d44fcae  2023-06-28  Yaroslav Vorobev  feat(test): add MOZ_AUTOMATION=1 to ff test runner (#2049)
  6e675f80  2023-06-28  Parker Lougheed  Replace broken link to observatory with DevTools mention (#2047)
  2904779b  2023-06-28  Yaroslav Vorobev  feat(runner): add env overrides for safari and ff (#2042)
  54350282  2023-06-28  Parker Lougheed  Update link from old linter site to dart.dev (#2046)
  8c4b15d1  2023-06-28  Jacob MacDonald  allow the latest analyzer (6.x.x) (#2045)

Change-Id: I86901fb2211adf81288f0940a355d6c33ddd8a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311927
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants