boo-lang / boo Goto Github PK
View Code? Open in Web Editor NEWThe Boo Programming Language.
License: BSD 3-Clause "New" or "Revised" License
The Boo Programming Language.
License: BSD 3-Clause "New" or "Revised" License
Compilation of the following statement "[[[[[[[[[[[[[[[" fails with StackOverflowException.
The same is reproduced for multiple '('.
Tried with booc versions 0.9.4.
Macros with arguments work fine. Extended nested macro syntax works fine. Trying to combine the two causes problems, though:
macro foo:
pass
macro foo.bar(value as IntegerLiteralExpression, body as Statement*):
pass
foo:
bar 1:
"Hello World"
"Goodbye Cruel World"
In this case, the macro expansion generates pattern-matching macro statements to verify that the macro invocation matches the signature, without adding Boo.Lang.PatternMatching
to the parent module's imports. This leads to compiler errors about unknown identifiers like "case", "match" and "otherwise".
>>> System.i
1: System.IO
2: System.IComparable
3: System.IComparable[of T]
4: System.IFormattable
5: System.IConvertible
6: System.ICloneable
7: System.IDisposable
8: System.IEquatable[of T]
9: System.IAppDomainSetup
10: System.IAsyncResult
... (more candidates)
>>> System.i
Type [Cursor Left]
... (more candidates)
17: System.InsufficientExecutionStackException
18: short
19: int
20: long
21: System.IntPtr
22: System.InvalidCastException
23: System.InvalidOperationException
24: System.InvalidProgramException
25: System.InvalidTimeZoneException
26: System.IServiceProvider
>>> System.i
Type [Escape]
>>>
Type [Return]
>>>
The command really has been removed.
I get the following errors when trying to compile Boo on Mac OS (Mono 3.2.3).
booi:
[booc] Compiling 6 files to '/Users/niklas/Downloads/boo-master/build/booi.exe'.
[booc] /Users/niklas/Downloads/boo-master/src/booi/CompilationCache.boo(87,45): BCE0019: 'Parse' is not a member of 'System.Guid'.
[booc] /Users/niklas/Downloads/boo-master/src/booi/booi.boo(195,12): BCE0019: 'Restart' is not a member of 'System.Diagnostics.Stopwatch'.
[booc] /Users/niklas/Downloads/boo-master/src/booi/booi.boo(206,33): BCE0019: 'IsDynamic' is not a member of 'System.Reflection.Assembly'.
[booc] /Users/niklas/Downloads/boo-master/src/booi/booi.boo(313,20): BCE0019: 'IsDynamic' is not a member of 'System.Reflection.Assembly'.
[booc] 4 error(s).
Any idea what is wrong?
Start booish
type in 1234567
move cursor 2 steps left. type DEL. nothing happens.
move cursor 2 steps right. type DEL. exception on invalid index.
Hi! I wrote some code where a class implements two interfaces that extends the same interface. I was expecting that to be allowed since it is in most languages (including C# I tested it) but in boo it fails. Actual code:
https://gist.github.com/BitPuffin/f213c48dd886fe6e39b5
Same thing in C#:
If it's not supposed to be allowed, could someone then suggest a way that I could achieve the same thing?
Thanks!
According to the interface_property
rule in boo.g, a property's param declaration can begin with an open bracket or an open paren, and end with a close bracket or a close paren. That means that this will work (verified in booish):
interface IFoo:
Values[i as int):
get
Hi,
The latest version is 0.9.4.9, I hope you can tag 0.9.4.10 or 0.9.5 in github as usual.
Thanks.
class TFoo(object):
pass
def foo[of T(TFoo)](bar as T):
bar = null
This should work as expected, but instead it raises a compiler error: Cannot convert 'null' to 'T'.
This came up while working on converting Boo.Lang.Compiler
to Boo. See Node.GetRootAncestor
for one example.
In C# you can do:
typeof(List<>)
In Boo this does not work. Instead you have to do a hack like this:
typeof(List[of Object]).GetGenericTypeDefinition()
So there is some missing syntax, because you can't just write List[] or List[of]
Does Boo have a built-in GUI library for GUI programs? If not, that'd be something great to add.
so some tests fail to compile
namespace A
import A.B //assume this is a valid namespace in our project
class Foo:
bar 1
macro bar(value as int):
pass
Expected: this should compile
Observed: Bogus error BCE0021 on any import statement that imports the current namespace or any sub-namespace thereof.
I've attached the source file you asked about.
Is there anything else I provide in order to help you to fix it?
Should I stop hoping for a fix at all?
While parsing the following line of a boo code file "import System" the BooLexer class' nextToken() method returns tokens with the following properties:
token text = "import", token type = 38
token text = " ", token type = 128
token text = "System", token type = 80
.
.
.
token text = null, token type = 1
There are a bunch of constants for token types in various places in the Boo.Lang.Parser package which seem inconsistent with what the BooLexer is actually returning, I copy pasted some constants of interest below from the BooLexer class itself:
public const int GOTO = 38;
public const int IMPORT = 39;
public const int ML_COMMENT = 128;
public const int WS = 129;
public const int SINGLE_QUOTED_STRING = 80;
public const int ID = 81;
public const int EOF = 1;
public const int NULL_TREE_LOOKAHEAD = 3;
It looks to me like the constants are all off by 1 with the exception of the EOF constant, the fact that the constant values skip over the number 2 looks suspicious.
When running booish with following commands:
import System
Console.C
<press tab key>
The shell crashes with following exception
Unhandled Exception: System.InvalidOperationException: Environment is not available!
at Boo.Lang.Environments.My`1.get_Instance()
at Boo.Lang.Compiler.TypeSystem.IEntityExtensions.DisplayName(IEntity entity)
Since we cannot submit Pull Requests to the Wiki, here's a patch that can be applied to the repository for someone with push access to: https://github.com/boo-lang/boo.wiki.git
You can apply this patch using: git apply gnat_wiki_update.patch
Thanks!
Boo.Lang:
[csc] Compiling 50 files to 'c:\svn\boo2\build\Boo.Lang.dll'.
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\DynamicDispatching\PropertyDispatcherFactory.cs(31,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\CandidateMethod.cs(31,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(2,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Properties.cs(2,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Environments\My.cs(92,59): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(10,34): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(15,41): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(20,45): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(25,49): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(30,31): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(40,39): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(45,47): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(50,83): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(50,67): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(50,56): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(55,91): error CS0305: Using the generic type 'System.Action<T>' requires '1' type arguments
[csc] c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(55,75): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(55,64): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(60,92): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(60,76): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(60,65): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(65,101): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(65,85): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(65,74): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(70,108): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(70,92): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(70,81): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(75,70): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(75,59): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(80,64): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(87,61): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Methods.cs(87,50): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Properties.cs(9,66): error CS0246: The type or namespace name 'Func' could not be found (are you missing a using directive or an assembly reference?)
[csc] c:\svn\boo2\src\Boo.Lang\Runtime\Properties.cs(9,55): error CS0246: The type or namespace name 'Expression' could not be found (are you missing a using directive or an assembly reference?)
BUILD FAILED
lexer for CudaText and Synwrite (2 editors use one lexer):
Now in addon-manager:
in Synwrite: Options/ AddonManager/ Install, in list type "boo" and choose Boo lexer. After installed, open any .boo file.
in Cudatext: same
lexer supports Tree panel.
class Optional[of T]():
private some as T
private none as bool
public static def Some(s as T):
o as Optional[of T] = Optional[of T]()
o.SetSome(s)
return o
public static def None():
o as Optional[of T] = Optional[of T]()
o.SetNone()
return o
public def Extract(ifSome as callable, ifNone as callable):
if self.none:
ifNone()
else:
ifSome(self.some)
public def SetSome(some as T):
self.some = some
self.none = false
public def SetNone():
self.none = true
enum Balls:
SHAVED
HAIRY
def Test():
optionalBalls = Optional[of Balls].None()
optinoalBalls = Optional[of Balls].Some(Balls.SHAVED)
balls = Balls.HAIRY
haveBalls = false
optionalBalls.Extract({ b | balls = b; haveBalls = true }, {})
if haveBalls:
Debug.Log("We have balls that are " + balls.SHAVED)
else:
Debug.Log("No balls here :/")
I've only tested this in the Unity boo version but I suspect it is present in regular boo too. I have already reported it to Unity via the bug report thing in the editor. Just wanted to give you the same information so that they don't end up with a less buggy boo than real boo :)
namespace MyNamespace
import System
import System.Collections.Generic
import Boo.Lang.Compiler
[Extension]
def IndexWhere[of T]([Required] coll as IEnumerable[of T], [Required] filter as Func[of T, bool]) as IEnumerable[of int]:
return IndexWhereImpl(coll, filter)
private def IndexWhereImpl[of T](coll as IEnumerable[of T], filter as Func[of T, bool]) as IEnumerable[of int]:
index = 0
for value in coll:
if filter(value):
yield index
++index
Expected: This should work
Observed: Internal compiler error: Failed to create 'MyNamespace.MyNamespaceModule.$IndexWhereImpl$248.$' type.. (BCE0055)
class SomeClass:
def constructor():
pass
class Foo[of T(class)]:
pass
class Bar[of T(SomeClass, constructor)](Foo[of T]):
pass
This will fail at BindBaseTypes
, with an error on Bar
that T
needs to be a reference type. Obviously T
satisfies the constraint, but because no type resolution has taken place yet, the compiler has no way of knowing whether or not SomeClass
is a class reference at this phase.
def A():
def c([required] s as string):
pass
booc requiredclosure.boo
Boo Compiler version 0.9.7.0 (CLR 2.0.50727.8009)
requiredclosure.boo(2,5): BCW0003: WARNING: Unused local variable 'c'.
1 warning(s).
requiredclosure.boo(2,12): BCE0015: Node '[required]' has not been correctly processed.
1 error(s).
Assembly 1:
callable FooDelegate(ref int)
Assembly 2:
class Foo:
private del as FooDelegate
private def DoFoo(ref int):
pass
def constructor():
del = self.DoFoo
Expected: This should work
Observed: Cannot convert 'callable(ref int) as void' to 'FooDelegate'. (BCE0022)
benchmark "set property":
(Item() as duck).name = "foo"
benchmark "static set property":
Item().name = "foo"
interface IFoo:
A as int:
get
B as int:
get
class Base:
A as int:
get: return 42
class Derived(Base, IFoo):
B as int:
get: return 7
Expected: This should work
Observed: Internal compiler error: Failed to create 'MyNamespace.Derived' type.
(Error occurs during EmitAssembly step.)
Like the title said.
[noatuhsauthaouhoaneunouhnau]
callable foo() as void
Compiles just fine.
More context and examples on the mailing list
But basically BindAndApplyAttributes does not override OnCallableDefinition so it doesn't process it at all.
Cheers
The ProcessClosureBody method within ProcessMethodBodies is called from a LINQ query that iterates over a list of possible candidates. It starts with MarkVisited(node);
, but neglects to put a WasVisited
guard before that, which means that the code below it that calls CodeBuilder.CreateMethod
and then CurrentMethod.DeclaringType.Members.Add(closure);
can run multiple times for the same closure.
The text on that page renders, but the code snippets / examples do not display (making the page not very interesting).
The code snippets seem to wrapped in <script> tags and CDATA tags, but the end result is that where code ought to be there's just an empty grey box.
Confirmed on Chrome, Safari, and Firefox on OSX Lion.
Here is an example of generic method which needs the second type to be inherited from the first type... The error says DefaultSomething
needs to be inherited from ISomething
when it already is.
interface ISomething:
def Work()
class DefaultSomething(ISomething):
def Work():
print "I'm working..."
static class Container:
static def Register[of TRegister(class), TRegisterImpl(class, TRegister)]():
print "Registration succeeded."
Container.Register[of ISomething, DefaultSomething]() # failed!
namespace GenericsBugs
class Foo[of T]:
private callable Bar(value as Foo[of T]) as T
_bar as Bar
public def BreakSomething():
_bar(self)
This should compile and work as expected, assuming _bar
is assigned somewhere. Unfortunately, it never makes it that far.
The best overload for the method 'GenericsBugs.Foo.Bar' is not compatible with the argument list '(GenericsBugs.Foo[of T])'. (BCE0017)
import System.Collections.Generic
def ggm[of T](l as IEnumerable[of T]) as IEnumerator[of T]:
for e in l:
yield e
Boo Compiler version 0.9.7.0 (CLR 2.0.50727.8009)
Main.boo(2,5): BCE0055: Internal compiler error: Failed to create 'MainModule.$ggm$2' type..
1 error(s).
More discussion: https://groups.google.com/forum/#!topic/boolang/B7glLpCci-M
import Boo.Lang.2
Expected: This should raise some meaningful error
Observed: Unexpected token: .2.[antlr.NoViableAltException: unexpected token: [".2",<132>,line=7,col=13]] (BCE0043)
http://boo.codehaus.org is not available. Some links still lead there.
I am unable to read the information there, because i have no idea of how to log in, and I can't see why I even should.
Is that true? Which fork should a person use?
Consider the following sample code. I define an interface IPerson and a generic interface IAddress that has a property Person of type T, where type T must inherit from IPerson.
Furthermore, there's a base class BaseAddress, also generic, and a simple implementation of IPerson in the class Person.
interface IPerson:
Age as int:
get:
pass
interface IAddress[of T(class, IPerson)]:
Person as T:
get:
pass
class BaseAddress[of T(class, IPerson)](IAddress[of T]):
_person as T
virtual Person as T:
get:
return _person
def PersonAge() as int:
return Person.Age
class Person(IPerson):
_age as int
Age as int:
get:
return _age
/*
class Address(BaseAddress[of Person]):
pass*/
This works fine, until I uncomment the class Address. Then I get a compiler error:
'Age' is not a member of 'T'. (BCE0019)
Even when it compiles successfully, if I open up the generated assembly in ILSpy I notice that the code isn't exactly how it should be. More specifically, the generic constraints are applied to the BaseAddress class but not in the IAddress interface:
public interface IAddress<T> where T : class
[Serializable]
public class BaseAddress<T> : IAddress<T> where T : class, IPerson
Edit: forgot to mention I tried with .NET 4, booc versions 0.9.4, 0.9.5 and also building from scratch from the latest source (0.9.7).
asm = Assembly.GetAssembly(self.GetType())
methods = asm.GetTypes().SelectMany({t as Type | t.GetMethods()})
applied = methods.Where({m as MethodInfo | m.GetCustomAttributes(MyMacroAttribute, false).Any()}).ToArray()
Expected: The applied
array should contain the method with the macro applied to it.
Observed: The applied
array is empty.
My own selfish desire is a want to be able to talk with other people about Boo quasi-quotes short of sending them to mailing list or Bamboo's blog or test cases- even if it's merely moving some of the blog or mailing list talk onto the boo.codehaus.org website, having some kind of documentation on the site would be greatly appreciated. Cheers.
macro a:
macro b:
DoSomething()
return whatever
macro a.b.c:
DoSomethingElse()
Expected: this should work
Observed: Compiler error: "No macro 'a.b' has been found to extend"
If you call a meta method that returns a MethodInvocationExpression
where one of the parameters is a BlockExpression
that declares a typed argument, the compiler will choke on the argument's type, saying that the node has not been correctly processed. (I'm sure there are simpler ways to reproduce this, but that's the real-world case that caused it.)
The cause of the problem appears to be that when the meta method returns its result expression, ProcessMethodBodies
grafts it into the appropriate place on the AST, then calls Reify(Expression)
on it, which runs reification on that individual node, but not on its subtree.
I am unable to build extras/booish.gui
and the error is complete nonsense:
[booc] b:\tests\boo\extras\booish.gui\src\CodeCompletionData.boo(78,38): BCE0004: Ambiguous reference 'IEntity': Boo.Lang.Compiler.TypeSystem.IEntity, Boo.Lang.Compiler.TypeSystem.IEntity.
How can I have ambiguity between two same things? There are more identical errors.
How it started: I have downloaded current boo-master, extracted and wanted to run booish.exe from the bin directory - ERROR! (Win8.1 CZ)
Neošetřená výjimka: System.Security.SecurityException: Požadavek na oprávnění typu System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 se nezdařil.
v System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
v System.Security.CodeAccessPermission.Demand()
v System.Environment.InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, Boolean suppressSecurityChecks)
v System.Environment.GetFolderPath(SpecialFolder folder)
v Boo.Lang.Interpreter.InteractiveInterpreterConsole..ctor()
v BooishModule.Main(String[] argv)
So, downloaded NAnt, altered my system PATH variable and typed nant test
. All went good. I wanted to try something, booish.gui
looked good. It took me some time to find out that I need old SharpDevelop 3.x (4.x and 5.x use AvalonEdit) and create build.properties
to set boo.profile=build
. But now I am getting these strange errors. What is going on?
BTW: ILSpy found exactly one interface IEntity
in all dlls in build directory of booish.gui.
import System.Linq.Enumerable
var x = (1, 2, 3)
var value = x.Average()
print value
This should work as expected, (and the equivalent C# code works fine,) but booc
throws a compiler error:
Ambiguous reference 'Average': System.Linq.Enumerable.Average(System.Collections.Generic.IEnumerable[of int]), System.Linq.Enumerable.Average(System.Collections.Generic.IEnumerable[of System.Nullable[of int]]). (BCE0004)
Boo has an unfortunate method of interpreting (and ignoring) whitespace that can leave to very undetectable problems. For instance, consider the following code:
class Person():
public hairColor as string
def about():
print hairColor
class Person():
public hairColor as string
def about():
print hairColor
Given proper editor circumstances, the user might believe the two pieces of code to be equivalent. However, boo interprets the change in whitespace delimiters (spaces -> tabs) in the second example to mean a change in scope, and as a result the definition is interpreted as a top-level function instead of a method.
Effectively, the code in the first example is interpreted correctly, and the second example is interpreted as:
class Person():
public hairColor as string
def about():
print hairColor
This should be fixed by doing as python does — raising an error when an unexpected change in indentation levels occurs.
A double literal can be force-declared as type float
by appending a f
suffix. A number can be declared as a timespan literal by appending a timespan suffix. But mixing them doesn't appear to work well.
3.0fs
Expected: This should declare a timespan literal of 3 seconds.
Observed: Error: TimeSpan does not accept floating point Not-A-Number values.
def Test():
arr as (int)
Array.Resize(arr, 5)
Expected: Type inference detects that we're dealing with an array of ints here
Observed: Type inference fails, and requires the last line to be stated as Array.Resize[of int](arr, 5)
value as uint = 0xFFFFFD80
value /= 128
Expected: This should work
Observed: Raises an overflow exception
def test(*args):
for arg in args:
print arg
# Works fine:
test(*(1, 'test'))
# Results in two blank lines:
test(*(1, 2))
# Crash!
test(*(1, 2, 3))
Running booi with an empty file or a file containing the following code causes a crash due to a NullReferenceException.
class Foo:
def Bar():
print "Baz"
However, adding any statement that is actually executed removes the problem. For example, the following code does not cause an exception:
class Foo:
def Bar():
print "Baz"
f = Foo()
def foo(bar as long):
print bar, 'long'
def foo(bar as double):
print bar, 'double'
i as int = 5
foo(i)
This code does two different things, depending on whether Ducky is set, and both behaviors are incorrect.
The correct behavior is obvious: as long
is an integer type and double
is not, invoking this with an integer argument should print 5 long
. But with Ducky set true
, it prints 5 double
, and with Ducky set false
, it raises a compiler error: Ambiguous reference 'foo'
.
(This example is based on a real-world problem that came up while converting Boo.Lang.Compiler
to Boo: calls to CodeSerializer.Serialize()
with an argument of type int
break because of this bug. It works fine in C#.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.