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

  • SEARCH
  • Home
  • 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 8317095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:30:36+00:00 2026-06-08T21:30:36+00:00

I have a problem with implicit function, imported from a package. I have a

  • 0

I have a problem with implicit function, imported from a package.

I have a class that uses Regex to find something in a text. I would like to use it as:

val pattern = "some pattern here".r                                          
pattern findSomethingIn some_text                                            

To do so, I define an implicit finction to convert pattern to a wrapper Wrapper that contains findSomethingIn function

package mypackage {                                                          

  class Wrapper ( val pattern: Regex ) {                                     
    def findSomethingIn( text: String ): Something = ...                     
  }                                                                          

  object Wrapper {                                                           
    implicit def regex2Something( pat: Regex ): Wrapper = new Wrapper( pat ) 
  }                                                                          

}                                                                            

if I use it as

import mypackage._                                                           

Wrapper.regex2Something( pattern ) findSomethingIn some_text                 

it works. whereas if i use

pattern findSomethingIn some_text // implicit should work here??             

I get

value findPriceIn is not a member of scala.util.amtching.Regex               

so the implicit conversion does not work here… What is the problem?

  • 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-06-08T21:30:39+00:00Added an answer on June 8, 2026 at 9:30 pm

    You will need

    import mypackage.Wrapper._
    

    to import the appropriate methods.

    See this blog entry for more info, and note in particular the definition/import of the Conversions object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom CustomMembershipUser that inherits from MembershipUser. public class ConfigMembershipUser : MembershipUser
I have a problem with what appears to be some sort of implicit casting
I'm trying to find optimized parameters for a model defined by an implicit function
My latest problem is one that I already have a solution for, it just
i have some problem in scala to resolve implicit values, and i have the
I have problem that I need to create timer but I want to pass
I have problem with Indy IdHttp Post method. Function CallRpc() compiled with Delphi 2007
In cases where you have a function that works for many different custom types
When I use glTranslatef I have warning Implicit declaration of function 'glTranslatef' is invalid
Working on a problem where I have to read data from a file into

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.