[NSNull parse:]: unrecognized selector sent to instance

24 views
Skip to first unread message

tim lindner

unread,
Aug 15, 2009, 12:41:20 AM8/15/09
to Programming Nu
Hello everyone. Brand new Nu user. I'm adding it to a program I am
writing because it seemed a good fit to allow for extensions.

Currently I am loading a evaluating Nu files before NSApplicationMain
() is called.

Everything was going well until I tried string interpolation:

(Class B is A
(- method is
(set val 2)
(puts "The Val: #{val}")))

When ever I call the method I get:

** -[NSNull parse:]: unrecognized selector sent to instance 0xa065a020

I need help understanding what is going wrong.

Tim Burks

unread,
Aug 15, 2009, 12:47:44 AM8/15/09
to program...@googlegroups.com

Hi Tim,

Have you seen this page: http://programming.nu/usage ?

It has some examples that might be helpful to you.

If not, please post some code that shows your problem and we'll take a
look at it.

Tim

tlin...@macmess.org

unread,
Aug 15, 2009, 1:24:32 AM8/15/09
to Programming Nu


On Aug 14, 9:47 pm, Tim Burks <timbu...@gmail.com> wrote:
> Hi Tim,
>
> Have you seen this page:http://programming.nu/usage?
>
> It has some examples that might be helpful to you.

Yes I have seen that page. Nothing clicked for me.

> If not, please post some code that shows your problem and we'll take a  
> look at it.
>

OK. In main() before NSApplicationMain() I load parse and eval all Nu
files in my app bundle like this:

NSAutoreleasePool *pool = [NSAutoreleasePool new];
id nu = [Nu parser];
for (NSString *nuFile in [[NSBundle mainBundle]
pathsForResourcesOfType:@"nu" inDirectory:nil])
[nu eval:[nu parse:[NSString stringWithContentsOfFile:nuFile]]];
[nu close];
[pool release];

The single nu file I currently is this:

;; TLOS9Analyzer
;; Classes to create blocks of OS-9 (CoCo) formatted disks.
;;
;; by tim lindner

(set $configDictionary (NSDictionary dictionaryWithList:(list
"Description" "Creates OS-9 LSN blocks out of track/side/sector
blocks.")))
(set $tag "OS-9 Logical Sector")

(class TLLSN is TLStreamAnalyzer
(- configuration is $configDictionary)

(- attributeDescriptors is nil)

(- tag is $tag)

(- analyzeStream:block withSettings:theSettings is
(block startBlockWithTag:$tag withPad:255)
(block addMeta:"LSN0" forName:"name")
(block addRange:(TLRange rangeWithBlock:"track 0,0 side 0,0
sector *,1" fromSection:"data" starting:0 withLength:0)
forSection:"data" expectedSize:256)
(block endBlock)

;; Calculate Allocation Bit Map length
(set LSN0 (block getDataFromBlock:"LSN0" fromSection:"data"))
(set ABMByteCount (LSN0 bigEndianUnsignedShortAtOffset:4))

;; Create ABM block
(block startBlockWithTag:$tag withPad:255)
(block addMeta:"ABM" forName:"name")
(set currentSector 2)

(while (>= ABMByteCount 256)
(set theString "track 0,0 side 0,0 sector *,#
{currentSector}")
(block addRange:(TLRange rangeWithBlock:theString
fromSection:"data" starting:0 withLength:0) forSection:"data"
expectedSize:256)
(set currentSector (+ currentSector 1))
(set ABMByteCount (- ABMByteCount 256)))

(set theString "track 0,0 side 0,0 sector *,#{currentSector}")
(block addRange:(TLRange rangeWithBlock:theString
fromSection:"data" starting:0 withLength:ABMByteCount)
forSection:"data" expectedSize:ABMByteCount)
(block endBlock)))

((TLStreamAnalyzer sharedAnalyser) addAnalyser:((TLLSN alloc) init))

When a use chooses the proper menu item, this subclass'
analzyeStream:withSettings: method is called. I only get the error:

*** -[NSNull parse:]: unrecognized selector sent to instance
0xa065a020

When I try to use string interpolation. Line 32 and 37.

Tim Burks

unread,
Aug 15, 2009, 1:32:25 AM8/15/09
to program...@googlegroups.com

Tim,

just to be sure that the problem is with string interpolation (and to
give you a workaround), please try rewriting your interpolations from
this:

(set theString "track 0,0 side 0,0 sector *,#{currentSector}")

to this:

(set theString (+ "track 0,0 side 0,0 sector *," currentSector))

This will run faster, too.

Tim

tlin...@macmess.org

unread,
Aug 15, 2009, 1:38:18 AM8/15/09
to Programming Nu


On Aug 14, 10:32 pm, Tim Burks <timbu...@gmail.com> wrote:
> Tim,
>
> just to be sure that the problem is with string interpolation (and to  
> give you a workaround), please try rewriting your interpolations from  
> this:
>
> (set theString "track 0,0 side 0,0 sector *,#{currentSector}")
>
> to this:
>
> (set theString (+ "track 0,0 side 0,0 sector *," currentSector))
>
> This will run faster, too.
>

That indeed works! Thanks.
Reply all
Reply to author
Forward
0 new messages