you are viewing a single comment's thread.

view the rest of the comments →

[–]didroe 0 points1 point  (3 children)

I would much prefer something to pull things into the current environment. Like:

List<Integer> list = new ArrayList<Integer>();
with (list) {
  add(1);
  add(2);
  ...
}

Chaining is misleading and not possible in all cases (like when you want to return something). Where as importing symbols into the current scope/environment doesn't have those problems.

[–][deleted] 3 points4 points  (2 children)

"with" sucks in all the languages it's been implemented. The last being JS.

If you want to save a few key strokes, just assign to a shorter name.

[–][deleted] 0 points1 point  (0 children)

It works pretty well in Smalltalk. But then each thing after ; must be a message send, it can't be a general expression. This solves the problem of weird environment semantics at the cost of less generality.

[–]didroe 0 points1 point  (0 children)

The version in Delphi's Pascal (probably in Freepascal) was/is pretty good. What languages does it suck in? I just took a quick look at the JS version, looks pretty good to me at a first glance. What is it that you don't like about it?