Useless error
Posted: Fri Jun 21, 2013 11:52 am
Hello again. I just spent about an hour finding a ghost compilation error and I thought I'd share it with you.
Try compiling the following code and when it fails, try to find where's the problem (this is just a dummy code I slapped together as a preview for the error):
The compiler gives me an unhelpful 'Missing statements. Use "pass" or other statements'. In another program that had the same little problem, I got an error that said: 'The correct local variable syntax is "name as Type" or "name = initValue". Try "the as Loads."'.
The reported line is 42, but the real problem lies on the line 14 (see the mistakenly placed letter 's'?).
Please don't take this as some kind of angry ranting, I just thought I'd put a little more effort into demonstrating what the problem is, I hope it's appreciated
Try compiling the following code and when it fails, try to find where's the problem (this is just a dummy code I slapped together as a preview for the error):
- Code: Select all
"""
Replace this text with a description of your program.
"""
class Program
"""
This is a program that doesn't do anything useful
"""
cue init
"""
rutrum enim sed leo dapibus fermentum. Pellentesque dui ante,
hendrerit quis augue eu, molestie dictum magna. Cum sociis natoque
""" s
.init(800, 124, 'Pellentesque sed leo dapibus fermentum')
cue init(x as int, y as int, s as String)
base.init
def main
print 'Hello, world!'
# Call function 1
# No parameters
.func1
# Quisque viverra sollicitudin nulla non luctus.
.func2
# Quisque viverra eros diam, a suscipit augue placerat no
# Curabitur dolor orci, dapibus a libero quis,
.func3
if 5 == 5
print 'Hello'
# Then call function 4
.func4
def func1
"""
r sagittis. Ut dictum felis sed purus ultrices tempus.
Donec ultricies mauris urna, eget pretium dolor bibendum eu.
"""
t = ['a', 'b', 'c']
for letter in t, print letter
def func2
"""
Pellentesque rutrum enim sed leo dapibus fermentum. Pellentesque dui ante,
hendrerit quis augue eu, molestie dictum magna. Cum sociis natoque
"""
d = {'a': 1, 'b': 2}
assert d['a'] == 1 and d['b'] == 2
for key, value in d
print '[key] = [value]'
def func3
"""
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Duis non sapien felis. Nulla dignissim, sem sed laoreet fermentum,
"""
letters = {'a', 'b', 'c'}
assert 'a' in letters
for letter in letters, print letter
def func4
"""
urna est malesuada sapien, venenatis consequat neque lacus non nibh.
Proin tempor rhoncus nunc, eget tristique nibh interdum quis.
"""
a as int
b as int
while a > b, a -= 1
The compiler gives me an unhelpful 'Missing statements. Use "pass" or other statements'. In another program that had the same little problem, I got an error that said: 'The correct local variable syntax is "name as Type" or "name = initValue". Try "the as Loads."'.
The reported line is 42, but the real problem lies on the line 14 (see the mistakenly placed letter 's'?).
Please don't take this as some kind of angry ranting, I just thought I'd put a little more effort into demonstrating what the problem is, I hope it's appreciated