Skip to content

Instantly share code, notes, and snippets.

Eugene Burmako xeno-by

Block or report user

Report or block xeno-by

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xeno-by
xeno-by / t5230_manual.scala
Created Dec 1, 2011
compose the tree, equivalent to t5230, by hand
View t5230_manual.scala
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
// todo. compose the tree, equivalent to t5230, by hand
import scala.reflect.mirror._
import scala.reflect.api._
import scala.reflect.api.Modifier._
View gist:1433353
Func<String, String> x = name => {
var buf = new StringBuilder();
for (var i = 0; i < name.Length; ++i) {
var prev = i == 0 ? '\0' : name[i - 1];
var curr = name[i];
var next = i == name.Length - 1 ? '\0' : name[i + 1];
if (Char.IsLower(prev) && Char.IsUpper(curr) && !Char.IsUpper(next)) {
buf.Append("-");
buf.Append(Char.ToLower(curr));
} else {
View gist:1443232
error: recursive method factorial needs result type
Exception in thread "main" java.lang.Error: reflective compilation has failed
at scala.reflect.runtime.ToolBoxes$ToolBox$ToolBoxGlobal.runExpr(ToolBoxes.scala:95)
at scala.reflect.runtime.ToolBoxes$ToolBox.runExpr(ToolBoxes.scala:168)
at scala.reflect.runtime.ToolBoxes$ToolBox.runExpr(ToolBoxes.scala:171)
at Test$delayedInit$body.apply(t5274_0.scala:16)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:61)
at scala.App$$anonfun$main$1.apply(App.scala:61)
@xeno-by
xeno-by / gist:1453440
Created Dec 9, 2011
lifted code that uses boundSyms: does not work
View gist:1453440
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
val code = scala.reflect.Code.lift{
class C
println(List(new C()).map(x => x).length)
};
@xeno-by
xeno-by / gist:1453447
Created Dec 9, 2011
non-lifted code: works
View gist:1453447
object Foo extends App {
class C
println(List(new C()).map(x => x).length)
}
@xeno-by
xeno-by / gist:1453452
Created Dec 9, 2011
lifted code that uses non-bound syms: works
View gist:1453452
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
val code = scala.reflect.Code.lift{
println(List(1).map(x => x).length)
};
val reporter = new ConsoleReporter(new Settings)
@xeno-by
xeno-by / gist:1523254
Created Dec 27, 2011
Manual compilation of scalac
View gist:1523254
=== launch-scalac.bat ===
@echo off
rem never ever use -Dscala.usejavacp=true here!!
java >con ^
-classpath >con ^
C:\Users\xeno.by\workspace\Kepler\lib\fjbg.jar;C:\Users\xeno.by\workspace\Kepler\lib\forkjoin.jar;C:\Users\xeno.by\workspace\Kepler\build\locker\classes\compiler;C:\Users\xeno.by\workspace\Kepler\build\locker\classes\library >con ^
scala.tools.nsc.Main >con ^
@d:\quicklib >con ^
-Ydebug
View .gitignore
/build
/build/
/target
/target/
target/
/dists/
/out/
/bin/
/project/boot/
/project/build/target/
View .test
test\files\run\reify_anonymous.scala
test\files\run\reify_for1.scala
test\files\run\reify_generic1.scala
test\files\run\reify_generic2.scala
test\files\run\reify_getter.scala
test\files\run\reify_inheritance.scala
test\files\run\reify_printf.scala
test\files\run\reify_splices1.scala
test\files\run\reify_varargs.scala
test\files\run\t5230.scala
View .classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="build/locker/classes/library" path="src/library"/>
<classpathentry kind="src" output="build/locker/classes/compiler" path="src/compiler"/>
<classpathentry kind="lib" path="lib/ant/ant-contrib.jar"/>
<classpathentry kind="lib" path="lib/ant/ant-dotnet-1.0.jar"/>
<classpathentry kind="lib" path="lib/ant/ant.jar"/>
<classpathentry kind="lib" path="lib/ant/maven-ant-tasks-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/ant/vizant.jar"/>
<classpathentry kind="lib" path="lib/fjbg.jar"/>
You can’t perform that action at this time.