Fix wrong use search #849

Closed
wants to merge 2 commits into
from

Projects

None yet

4 participants

@zhaihj
Contributor
zhaihj commented Jan 9, 2015

Problem Description:

UseDef findUse() return wrong path according to the order of soures.

Assume that we have ./ooc-math.use and ./source/sdk/math.use. When searching for math.use, the following code

if(subPath getPath() endsWith?(fileName))

gives ooc-math.use instead of math.use because both of them have suffixes "math.use" but ooc-math is searched first. This will cause circle dependency problem.

How to reproduce:

Compile ooc-kean with the lastest rock.

Fix:

  • Added getName() to extract filename from path.
  • When getName() does not work well, it will return the first match of endWiths.
@fasterthanlime
Collaborator

Tried to reproduce by building ooc-kean, but it's failing earlier with a redefinition of abs, which seems weird:

screen shot 2015-01-12 at 16 29 45

@fasterthanlime fasterthanlime added a commit that referenced this pull request Jan 12, 2015
@fasterthanlime fasterthanlime Fix use search. #849 da917b2
@fasterthanlime
Collaborator

@zhaihj Can you please have a look at da917b2 ? That should fix it.

@davidhesselbom
Contributor

Goodness, that's a big text size for a terminal. 4K?

@davidhesselbom
Contributor

Btw, just fixed the abs problem, which mysteriously appeared today.

@fasterthanlime
Collaborator

@davidhesselbom Just a retina display :) (native resolution: 2880x1800).

About abs: I think it might be related to the stricter checks introduced in 80e0a09

(Which, in retrospect, explains a0c178c). Imho type extensions should be able to redefine functions if they feel like it, although that might be too obscure. Hm.

@vendethiel

Do you want to open ruby's biggest can of worms :)?

@fasterthanlime
Collaborator

@vendethiel d'awwwwww good point let's not talk about open classes or monkey-patching or any of that scripting language nonsense.

(But, btw, type extensions in ooc are a lie — and completely bypass the vtable.)

@vendethiel

Sorry, it's been a long time since I last looked at some rock, but I just think... It's a bad idea to add that :P.

@fasterthanlime
Collaborator

Actually it's been a very long time since I've read some parts of rock. And when I read it now, I just want to burn it all. To the ground. And rewrite it all. But who's got the time for that :(

Cogneco when you're rich, hire me, I'll make ooc better I promise.

@vendethiel

Would you have, in retrospect, liked better to make ooc a "google" language? (as I think you got an email from google or smth)

@fasterthanlime
Collaborator

I did get an e-mail from Google about a job offer — but they send hundreds of those everyday, it was nothing serious / personal. And it wasn't ooc-related as far as I could tell.

I've used ooc professionally at official.fm, and I've written another compiler at my current company, and I'm still today using ooc in another project, with yet another language on top — so, you know, I'm still "in the game" somewhat, just not running around, giving conferences and whatnot.

@davidhesselbom
Contributor

Just, you know, in case you're curious.

@fasterthanlime
Collaborator

@davidhesselbom that looks really cool :)

@vendethiel

Alright - amazing. Did see that new compiler :).

@fasterthanlime
Collaborator

@davidhesselbom well, you know, if you've got some extra funding, I wouldn't mind spending some time doing paid work to improve ooc.

I might have to look into... alternative solutions of a financial kind, for the near future. Oh well.

@davidhesselbom
Contributor

@fasterthanlime How much to fix #829? ;)

(actually, that one's been fixed, I just haven't had time to make a pull request yet. I haven't tried zhaihj's fix either, it might work even better than ours...)

I'll see if there's some extra money lying around the office, the idea has been brought up before.

@zhaihj
Contributor
zhaihj commented Jan 14, 2015

@fasterthanlime
that commit works perferctly. I will close this pr...

@zhaihj zhaihj closed this Jan 14, 2015
@fasterthanlime
Collaborator

Thanks for confirming @zhaihj !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment