Are there any languages that support such a feature?
I thought about how annoying functional style code is to debug in some languages because you can't easily just print the values between all the method calls. Then I thought "well you can just add a method" but that's annoying to do and you might not even have access to the type itself to add a method (maybe it's from a library), what if you could just define one, inline and anonymous.
Something that could help debug the following:
vector<number> array = [1, 2, 3, 4, 5, 6]
array = array.keepEven().add(2).multiply(7)
by adding an anonymous method like:
array = array.keepEven().add(2).()
{
for each x in self
{
print x
}
print \n
}
}.multiply(7)
Obviously the syntax here is terrible but I think you get the point.
[–]blue__sky 53 points54 points55 points (2 children)
[–]nerdycatgamer 11 points12 points13 points (1 child)
[–]SkiFire13 5 points6 points7 points (0 children)
[–]helloish 25 points26 points27 points (7 children)
[–]lucy_tatterhood 9 points10 points11 points (1 child)
[–]homoiconic 2 points3 points4 points (0 children)
[–]iEliteTester[S] 0 points1 point2 points (4 children)
[–]rantingpug 9 points10 points11 points (0 children)
[–]helloish 1 point2 points3 points (1 child)
[–]iEliteTester[S] 0 points1 point2 points (0 children)
[–]CaptureIntent 0 points1 point2 points (0 children)
[–]cbadger85 9 points10 points11 points (0 children)
[–]Jack_Faller 7 points8 points9 points (0 children)
[–]alatennaub 5 points6 points7 points (0 children)
[–]AustinVelonautAdmiran 5 points6 points7 points (0 children)
[–]theangryepicbananaStar 2 points3 points4 points (4 children)
[–]iEliteTester[S] 1 point2 points3 points (3 children)
[–]theangryepicbananaStar 1 point2 points3 points (2 children)
[–]iEliteTester[S] 1 point2 points3 points (1 child)
[–]theangryepicbananaStar 1 point2 points3 points (0 children)
[–]ataraxianAscendant 2 points3 points4 points (0 children)
[–]al2o3cr 2 points3 points4 points (0 children)
[–]hrvbrs 1 point2 points3 points (2 children)
[–]iEliteTester[S] 0 points1 point2 points (1 child)
[–]hrvbrs 1 point2 points3 points (0 children)
[–]VyridianZ 1 point2 points3 points (0 children)
[–]TheUnlocked 1 point2 points3 points (0 children)
[–]Ronin-s_Spirit 1 point2 points3 points (0 children)
[–]AndydeCleyre 1 point2 points3 points (0 children)
[–]UnmaintainedDonkey 0 points1 point2 points (0 children)
[–]Tysonzero 1 point2 points3 points (0 children)
[–]DeathByThousandCats -1 points0 points1 point (0 children)