Code Monkey home page Code Monkey logo

Comments (9)

wontaeyang avatar wontaeyang commented on August 15, 2024 1

I just ran into this too 👀 and was stuck for a while.
going back to exercises on methods seem to explain what is going on here 😆

from ziglings.

ratfactor avatar ratfactor commented on August 15, 2024 1

Okay everybody, I think I've improved it. I didn't fully realize how misleading and confusing the hints were on that one until I went in to fix it. Here it is now:

    // Oh dear, we seem to have done something wrong when calling
    // this function. We called it as a method, which would work
    // if it had a self parameter. But it doesn't. (See above.)
    //
    // The fix for this is very subtle, but it makes a big
    // difference!
    const Type2 = narcissus.fetchTheMostBeautifulType();

I hope it's much clearer now that we want to change the calling site, not the declaration! Thanks for all the helpful comments on this issue!

from ziglings.

ratfactor avatar ratfactor commented on August 15, 2024

@ricardomatias I just ran my checker script against the latest copy of Ziglings using a fresh snapshot of Zig:

$ zig version
0.10.0-dev.3394+1a1b7a3af

Compiling 065_builtins2.zig...
Checking 065_builtins2.zig...
PASSED:
A Narcissus loves all Narcissuses. He has room in his heart for: me myself.

That line 56 looks current. And it should check your minimum Zig version. Hmmmm... Oh, I think there was an instance where somebody was running a new version of Zig, but an old version of the standard library. Maybe it's something like that?

Could you paste the result of zig env?

Here's mine:

$ zig env
{
 "zig_exe": "/home/dave/zig/zig",
 "lib_dir": "/home/dave/zig/lib",
 "std_dir": "/home/dave/zig/lib/std",
 "global_cache_dir": "/home/dave/.cache/zig",
 "version": "0.10.0-dev.3394+1a1b7a3af"
}

from ziglings.

realgdman avatar realgdman commented on August 15, 2024

I have encountered same problem. Windows, Zig is 0.10.0-dev.3475+b3d463c9e.
On a side note, I think it uses local zig-cache in repo folder, not global one.
Even fiddling with official @This() example sometimes gives that error, so probably it's language issue

Btw, my understanding that you need to add (self: Narcissus) parameter, but it will complain about self not used, and supressing with _ = self explained only in Ex70. (I just happen to know this from somewhere)

from ziglings.

ricardomatias avatar ricardomatias commented on August 15, 2024

@ratfactor sorry for the late reply.. here it is:

{
 "zig_exe": "C:\\Users\\Ricardo\\scoop\\apps\\zig-dev\\current\\zig.exe",
 "lib_dir": "C:\\Users\\Ricardo\\scoop\\apps\\zig-dev\\current\\lib",
 "std_dir": "C:\\Users\\Ricardo\\scoop\\apps\\zig-dev\\current\\lib\\std",
 "global_cache_dir": "C:\\Users\\Ricardo\\AppData\\Local\\zig",
 "version": "0.10.0-dev.3394+1a1b7a3af"
}

from ziglings.

ratfactor avatar ratfactor commented on August 15, 2024

Wild. I do have a Windows desktop here I can test on.

from ziglings.

ratfactor avatar ratfactor commented on August 15, 2024

@realgdman Well, a self parameter should not be required to complete this one. I'm looking for a solution that uses builtins. You can peek at patches/patches/065_builtins2.patch to see what's expected.

Actually, @ricardomatias, this did not occur to me before for some reason, but could you check your answer versus the "official" answer ☝️? Thanks!

It's possible that what's expected in this exercise is not clear, in which case it may need some fixing to make it more clear!

from ziglings.

realgdman avatar realgdman commented on August 15, 2024

@ratfactor oh I got it, I misunderstand wording about "self parameter" and was fixing declaration instead of call.

from ziglings.

ratfactor avatar ratfactor commented on August 15, 2024

@realgdman Thanks for that. Clearly the wording on this one needs a little help!

from ziglings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.