It already seems harder to read these codes below:
Code: Select all
SetTimer(
tick() {
static n := 3
MsgBox n--,, 'T1'
if n = 0
SetTimer tick, false
}, 1000)
Details are in this I posted.
Code: Select all
SetTimer(
tick() {
static n := 3
MsgBox n--,, 'T1'
if n = 0
SetTimer tick, false
}, 1000)
What details? The link is invalid.Details are in this I posted.
Code: Select all
IsSet(ref) && ((&alias) {
alias ??= 0
alias++ ; Multiple references, no need for explicit %dereferencing%.
alias++
alias++
})(ref)
Code: Select all
Array.Prototype.DefineProp("Map", {Call: MapArrayByFunc })
Code: Select all
() => {
return 7
}
Sorry, not knowing what reason, the link is wrong. Now, I have updated it that you can access.
Code: Select all
a := () => {}
b := () => {}.DefineProp('call', {call: (this, a) => a is Object})
c := () => {
base:
b()
}(a) ? MsgBox(1) : MsgBox(0)
c()
This rule would not be backward-compatible.Returning object literals using the concise body syntax (params) => { object: literal } does not work as expected.
Source: Arrow function expressions - JavaScript | MDN
It will be three lines also. One line is not supported yet. It needs nearly the same inputs as before except that an f can be omited in f(){
The only "simplicity" than before might be f can be omited in f(){.cumulonimbus wrote: ↑04 Sep 2023, 18:37There are a lot of people who object to this way of defining things, but there are also a lot of people who like it, and what you think is "symbolic hell" may be a paradise of simplicity in the eyes of others.
This is really my main intention.
So, at least, the function must not be named if it is used as an expression. Once the function is named, it cannot be within an expression and should be formally defined. How is that?
Code: Select all
#requires AutoHotkey v2.1-alpha.4
((){
ListVars
ControlSetText "", "Edit1", A_ScriptHwnd
print(line) {
SendMessage 0xB1, -2, -1, "Edit1", A_ScriptHwnd
EditPaste line "`r`n", "Edit1", A_ScriptHwnd
}
OnMessage 0x100, KeyDown(vk, *) {
print "KD " GetKeyName(Format("vk{:x}", vk))
}
OnMessage 0x104, SysKeyDown(vk, *) {
print "SKD " GetKeyName(Format("vk{:x}", vk))
return 1 ; Disable menu
}
OnMessage 0x101, KeyUp(vk, *) {
print "KU " GetKeyName(Format("vk{:x}", vk))
}
OnMessage 0x105, SysKeyUp(vk, *) {
print "SKU " GetKeyName(Format("vk{:x}", vk))
return 1 ; Disable menu
}
OnMessage 0x102, Char(ch, *) {
print "C " Chr(ch)
}
OnMessage 0x106, SysChar(ch, *) {
print "SC " Chr(ch)
}
OnMessage 0x20A, MouseWheel(wParam, *) {
print "W " (wParam << 32 >> 48)
}
})()
Code: Select all
DefinePropPrim := Object().DefineProp
DefinePropPrim(String.Prototype, "f1", {Call: (str, mode){
if mode==1
return "one"
else if mode==2
return "two"
}})
Msgbox("test_str".f1(2))
Code: Select all
DefinePropPrim := Object().DefineProp
DefinePropPrim(String.Prototype, "f1", {Call: (str, mode){
Switch mode
{
Case 1:
return "one"
Case 2:
return "two"
}
}})
Msgbox("test_str".f1(2))