Newline Detection
Monkey Forums/Monkey Programming/Newline Detection
| ||
So, at the moment, trans will detect multiline code by splitting on operators and commas.Foo(1, 2, 3) a = 1 + 2 + 3 I'd like it to also split on periods, so we can chain method calls on multiple lines. Assuming Bar and Hello (and most likely World) do something like "Return Self", we could do this: foo.Bar(). Hello(). World() Instead of: foo.Bar() foo.Hello() foo.World() This would be amazing for creating factory/builder patterns. |
| ||
i also love to use self returning on "Setters" of objects, and i usually the have stuff likeNew Gui_TextButton.SetPosition(x,y).AttachTo(MainWindow).SetText("Options").SetValue(New GuiValue().SetMin(0).SetMax(100)).SetSize(100,20).SetFlags(AUTOPOSITION | HOVERFX | CLICKABLE).SetVisual(New GuiVisualBorder)).SetValueModification(LEFTMOUSE, INCREASE, 1).SetValueModification(RIGHTMOUSE, DECREASE, 1) wich can be really annoying, so i would also like to have such a multiline option |
| ||
@Salmakis: i also love to use self returning on "Setters" of objects You can do this with properties too, since they can be called like methods Class Gui_TextButton Field text:String ' getter Method Text:String() Property Return text End ' setter Method Text:Gui_TextButton(text:String) Property Self.text = text Return Self End End ' these are equivalent, except the second returns itself and can be chained t.Text = "hello" t.Text("hello") |