These are chat archives for notepad-lang/notepad-lang-specification
The Specification of Notepad Language. Please discuss the syntax etc about notepad-lang on this repo.
def hoge(x)
return x+1
end
def hoge(x):
__return x + 1
def hoge(x):
__x + 1
def hoge(x) : x+1
x + 1
だからラムダ式っぽくreturn省略できるんじゃなーいって考えでしたけど
def hoge(age):
__if 0 <= age:
____print "Your age is #{age}."
def hoge(age):
__print "Your age is #{age}." if 0 <= age
if 0<= age: print ""
でも手間変わらない感
print "Your age is #{age}." if 0 <= age else "Invalid"
なら Python っぽい
def hoge(x):
__return 0 if x>=100
__return 1
print ("Your age is #{age}" if 0<=age else "Inv")
print("")
を強制とか
__if 0 <= age:
____print "Your age is #{age}"
__else:
____print 'Invalid'
print ("your age is #{age}" else "invalid" in age<=0)
rubyは
print "a".to_i 36
とかできるはず
print
if 0 <= age:
"Your age is #{age}."
else:
"invalid"
ができない言語はクソ(?)
def hoge(i)
if i>=a then
print 1
else
print 0
fi
fed
(def hoge (i)
(print (cond (>= i a) 1 0))
)
class Hoge
prop Age(public,public)
def .ctor()
Age=0
fed
def ShowAge
print(
if Age>=0 then
"your age is #{Age}"
else
"invalid"
fi
)
fed
def IncrementAge
Age++
fed
ssalc
def this()
でいいと思った
def this
か
class Hoge
prop Age(public,public) = 0
# 上の prop は裏では次のような展開
# __age はバッキングフィールド
#
# def Age(age)
# this.__age = age
# fed
#
# def Age
# return this.__age
# fed
#
# def this
# this.__age = 0
# fed
def ShowAge
print(
if Age>=0 then
"your age is #{Age}"
else
"invalid"
fi
)
fed
def IncrementAge
Age++
fed
ssalc
_
, __
で勝手に private_
は private にならない、暗黙の了解だった。 __
だけだ
#1
.nplに一票
#1
拡張子は.nplにしましょうかね
class A
def hoge
local lclvar=0 #ローカル変数
instance insvar=1 #インスタンス変数
class clsvar=2 #クラスstatic変数
global glbvar=3 #グローバル変数
fed
ssalc
みたいな?
class clsvar
のところはそれは予約語を使いまわすっていうこと?
@public
とかで分かりやすいと思うけど、新しい構文を追加すると(ry
class A
def hoge
local
a = 0
instance
b = 0
...
hoge._np
とか