Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with a list of objects #25

Open
pmunts opened this issue Dec 14, 2018 · 1 comment
Open

Errors with a list of objects #25

pmunts opened this issue Dec 14, 2018 · 1 comment
Labels

Comments

@pmunts
Copy link

pmunts commented Dec 14, 2018

I experimented with lists of object instances:

' Define an object class

class Object
  var myadjective = "UNINITIALIZED"

  def Describe(s)
    myadjective = s
  enddef

  def Write()
    print "I'm an ", myadjective, " object!";
  enddef
endclass

print "Object List Test";;

' Create a list of object instances

Obj1 = new(Object)
Obj1.Describe("awesome")

Obj2 = new(Object)
Obj2.Describe("ugly")

ObjectList1 = List(Obj1, Obj2)

Obj1 = Nil
Obj2 = Nil

for X in ObjectList1
  X.Write()
next

' Create another list of object instances

Obj3 = new(Object)
Obj3.Describe("unfathomable")

Obj4 = new(Object)
Obj4.Describe("ordinary")

ObjectList2 = List(Obj3, new(Object))

Obj3 = Nil
Obj4 = Nil

for X in ObjectList2
  X.Write()
next

' Try to create a third list of object instances

ObjectList3 = List(new(Object), new(Object))

Here is the output from running the program:

Object List Test

I'm an awesome object!
I'm an ugly object!
I'm an unfathomable object!
I'm an ordinary object!
Error:
    Ln 53, Col 35
    Code 28, Abort Code 3
    Message: Colon expected.

At line 42 it executes, but the second item in the list is Obj4, instead of an uninitialized fifth object instance.
At line 53 it fails.

@paladin-t paladin-t added the bug label Dec 15, 2018
@blazer2k1
Copy link

@paladin-t curious about the status of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants