Coder Social home page Coder Social logo

Issue with named imports? about rock HOT 14 CLOSED

ooc-lang avatar ooc-lang commented on August 16, 2024
Issue with named imports?

from rock.

Comments (14)

nddrylliog avatar nddrylliog commented on August 16, 2024

I'm totally guilty of laziness on this one. fredreichbier was implementing namespaced imports in j/ooc, and I did the same in rock, following his tests that he wrote progressively, and I just bailed out on the 'namespaced types' issue, I only did the 'namespaced variables / functions' thingy.

I can fix it pretty easily, but if someone else wanna do it, I suggest you read the 'rock/middle/NamespaceDecl.ooc' class, and how it's used in 'rock/middle/FunctionCall' / 'rock/middle/VariableAccess'

from rock.

wandernauta avatar wandernauta commented on August 16, 2024

Has this been fixed yet?

from rock.

danopia avatar danopia commented on August 16, 2024

Related to #97

from rock.

nddrylliog avatar nddrylliog commented on August 16, 2024

Yes, #97 was a duplicate and has been closed

from rock.

duckinator avatar duckinator commented on August 16, 2024

Please tell me this has been fixed. If we're missing features j/ooc had.... :(

from rock.

nddrylliog avatar nddrylliog commented on August 16, 2024

Not been fixed afaict

On Mon, Sep 5, 2011 at 4:48 AM, duckinator <
[email protected]>wrote:

Please tell me this has been fixed. If we're missing features j/ooc had....
:(

Reply to this email directly or view it on GitHub:
#46 (comment)

Amos Wenger
Crafting the future of Web Audio at ofmlabs.org
I'm @nddrylliog https://github.com/nddrylliog on GitHub

from rock.

duckinator avatar duckinator commented on August 16, 2024

NOOOOOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooooooooooooooooooooooooooooooooooooo dies

from rock.

fredreichbier avatar fredreichbier commented on August 16, 2024

Sssshh. Nobody knows named imports exist anyway!

from rock.

nddrylliog avatar nddrylliog commented on August 16, 2024

yajl does!

On Tue, Sep 6, 2011 at 10:49 PM, Friedrich Weber <
[email protected]>wrote:

Sssshh. Nobody knows named imports exist anyway!

Reply to this email directly or view it on GitHub:
#46 (comment)

Amos Wenger
Crafting the future of Web Audio at ofmlabs.org
I'm @nddrylliog https://github.com/nddrylliog on GitHub

from rock.

alexnask avatar alexnask commented on August 16, 2024

I'll work on this, possibly this weekend, perhaps earlier if it is easy to do, I will use namespace imports in gooc-gen :P

from rock.

alexnask avatar alexnask commented on August 16, 2024

Ok I tried some stuff but it doesn't really work...
These are my changes at the moment:
Nagaqueen

TypeBase = FuncType |
          (< { tokenPos; core->typeBuffer[0]='\0'; type=NULL;} (CONST_KW -)?
            (
                ( "unsigned"                                  { strcat(core->typeBuffer, "unsigned "); } -
                | "signed"                                    { strcat(core->typeBuffer, "signed "); } -
                | "long" &(- ("long" | "double" | "int"))     { strcat(core->typeBuffer, "long "); } -
                | "struct"                                    { strcat(core->typeBuffer, "struct "); } -
                | "union"                                     { strcat(core->typeBuffer, "union "); } -
                )
            - )*
            rest:IDENT
            (type:IDENT)?
          > {
                if(!type) {
                    strcat(core->typeBuffer, rest);
                    $$=nq_onTypeNew(core->this, core->typeBuffer);
                } else {
                    strcat(core->typeBuffer, type);
                    $$=nq_onTypeNew(core->this, core->typeBuffer);
                    $$=nq_onTypeNamespace(core->this, $$, rest);
                }
            })

And in AstBuilder.ooc

    onTypeNamespace: unmangled(nq_onTypeNamespace) func (type: BaseType, ident: CString) -> Type {
        "yay for %s with %s" format(type toString(), ident) println()
        token() formatMessage("","","") println()
    }

However, there are a couple of issues. This is my test file:

import structs/ArrayList into AL

f: func -> AL ArrayList {
    null as AL ArrayList
}

And rock prints:

yay for ArrayList with ArrayList 

f: func -> AL ArrayList {
                         
yay for ArrayList with ArrayList

    null as AL ArrayList
            ~~~~~~~~~~~~
yay for toString with toString

    argc times(|i| result add(argv[i] as CString toString()))

The issues here are that for some reason, the first IDENT in the type rule is getting overwritten by the second IDENT and that there is ambiguity in statements like the last one. How are we supposed to know where the type stops and where the statement continues? I think making the use of parenthesis to access namespace types should be mandatory, as @fredreichbier had suggested in issue #97 a long time ago. This would make parsing easier and would clear out ambiguity as in the last statement.

from rock.

nddrylliog avatar nddrylliog commented on August 16, 2024

Okay, let's make parenthesis mandatory then.

(Otherwise, here's how it was done in j/ooc: I think it was parsed as a VariableAccess, and the access was resolved at tinkering time, and it was turned into a TypeAccess)

from rock.

alexnask avatar alexnask commented on August 16, 2024

Still, if we have for example the casting rule accept a variableaccess, in the last statement wouldn't CString toString() be parsed as a VariableAccess? Anyway, I'll work on the parenthesis for now and if I think of a clever way to make it work without them I will implement it.

from rock.

alexnask avatar alexnask commented on August 16, 2024

Closed by #380

from rock.

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.