Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6857427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:00:59+00:00 2026-05-27T02:00:59+00:00

I am new to the Go programming language and I have an assignment to

  • 0

I am new to the Go programming language and I have an assignment to create and interpreter but I am running into the following problem:

I want to define an Environment as:

type Environment struct{
    parent Environment
    symbol string
    value RCFAEValue
}

func (env Environment) lookup(lookupSymbol string) RCFAEValue{
    if lookupSymbol == env.symbol{
        return env.value
    } //if parent != nill {
        return env.parent.lookup(lookupSymbol)
}

But I get the error “invalid recursive type Environment”. Based on my research I changed the parent to type *Environment. But now when I need to create a new Environment with a var of type Environment it get the error “cannot use fun_Val.ds (type Environment) as type *Environment in field value”. I am creating the Environment as follows:

Environment{fun_Val.ds,fun_Val.param,exp.arg_exp.interp(env)}

I am trying to keep the amount of code in this post to a limit but if you need more, or have other questions please let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:01:00+00:00Added an answer on May 27, 2026 at 2:01 am

    You need to define Environment as:

    type Environment struct {
        parent *Environment // note that this is now a pointer
        symbol string
        value  RCFAEValue
    }
    

    Otherwise the compiler has no way to figure out what the size of the Environment structure is. A pointer’s size is known, but how big is something that contains itself? (And the inner struct contains itself as well, as does the inner inner struct, and so on.)

    Creating the Environment will then look like:

    Environment{&fun_Val.ds, fun_Val.param, exp.arg_exp.interp(env)}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to learn a new programming language. I have in mind stuff like
I'm currently developing a new language for programming in a continuous environment (compare it
I'm very new to Java programming language so this is probably dumb question but
I want to learn a new programming language and develop for the Android platform.
I have an interesting idea for a new programming language. It's based on a
I'm new to using the C#/.NET programming Language and I have created a DataGridView
I have a fair amount of practice with Java as a programming language, but
I am new in C programming language and have an (if statement) and need
Seeking programming language. Must have the following qualities (in order of ascending length of
Suppose I have designed a new programming language for one of the managed code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.